Maarten ter Huurne
2006-03-28 23:06:41 UTC
Hi,
On the following program:
===
class C:
def __init__(self):
self.set(self, 'abc')
def set(self, value):
self.__value = value
self.__length = len(value)
===
pylint reports:
===
W0201: 5:C.set: Attribute '__value' defined outside __init__
W0201: 6:C.set: Attribute '__length' defined outside __init__
===
Although strictly speaking they are indeed defined outside __init__, these
fields are guaranteed to be initialised when an object of type C is
constructed. It would be useful if pylint could recognise situations like
this one and not issue this warning.
Bye,
Maarten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.logilab.org/pipermail/python-projects/attachments/20060328/d2cdd9bf/attachment.htm
On the following program:
===
class C:
def __init__(self):
self.set(self, 'abc')
def set(self, value):
self.__value = value
self.__length = len(value)
===
pylint reports:
===
W0201: 5:C.set: Attribute '__value' defined outside __init__
W0201: 6:C.set: Attribute '__length' defined outside __init__
===
Although strictly speaking they are indeed defined outside __init__, these
fields are guaranteed to be initialised when an object of type C is
constructed. It would be useful if pylint could recognise situations like
this one and not issue this warning.
Bye,
Maarten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.logilab.org/pipermail/python-projects/attachments/20060328/d2cdd9bf/attachment.htm