python – Pylint错误W0232:类没有__init__方法

栏目: Python · 发布时间: 6年前

内容简介:正如@Sean指出的那样,如果在父类中定义__init __(),则pylint翻译自:https://stackoverflow.com/questions/19622484/pylint-error-w0232-class-has-no-init-method
我对pylint有以下错误:
Pylint error W0232: class has no __init__ method

我明白这意味着什么.我必须创建__init__方法.

问题是这个类是从父类继承的.我知道我能够创建__init__方法并且只使用super(myclass,self).__ init __()但是它真的有必要吗?我没有任何东西可以添加到__init__.我想知道在任何类中创建__init__方法是否更好.

正如@Sean指出的那样,如果在父类中定义__init __(),则pylint should not 会抱怨. Сhances是pylint找不到那个类.确保在 invoke pylint中实际加载了定义它的模块(例如在包含的包上运行它).

翻译自:https://stackoverflow.com/questions/19622484/pylint-error-w0232-class-has-no-init-method


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Test Driven Development

Test Driven Development

Kent Beck / Addison-Wesley Professional / 2002-11-18 / USD 49.99

Quite simply, test-driven development is meant to eliminate fear in application development. While some fear is healthy (often viewed as a conscience that tells programmers to "be careful!"), the auth......一起来看看 《Test Driven Development》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具