2
如果我从ctypes.BigEndianStructure派生类,如果我不调用BigEndianStructure,pylint会发出警告。 init()。伟大的,但如果我解决我的代码,pylint的仍然警告说:pylint超类错误__init__
import ctypes
class Foo(ctypes.BigEndianStructure):
def __init__(self):
ctypes.BigEndianStructure.__init__(self)
$ pylint mymodule.py
C: 1: Missing docstring
C: 3:Foo: Missing docstring
W: 4:Foo.__init__: __init__ method from base class 'Structure' is not called
W: 4:Foo.__init__: __init__ method from base class 'BigEndianStructure' is not called
R: 3:Foo: Too few public methods (0/2)
起初我以为这是因为结构来源于一个C模块。如果我从我的一个类或者纯粹的Python的SocketServer.BaseServer子类中获取警告,我不会收到警告。但是,如果我从smbus.SMBus继承而来,我也不会收到警告,它位于C模块中。
任何人都知道禁用W0231以外的解决方法?
啊,本来应该尝试显而易见的事情。谢谢。它修复了警告。我很好奇,但是Structure/BigEndianStructure使用super()吗?我见过的建议是使用super()iff超类使用super()... – bstpierre 2009-07-29 15:58:50