[Python-projects] pylint complains when initializing attribute via property()
skip at pobox.com
skip at pobox.com
Wed Jan 9 18:40:37 CET 2008
Suppose I have a new-style class which uses a property() call to define a
setter:
class C(object):
def __init__(self):
self.a = 5
def set_a(self, val):
self._a = val
def get_a(self):
return self._a
a = property(get_a, set_a)
pylint complains that self._a is initialized outside of __init__. It would
be nice if it could figure out that C.set_a is a valid place to initialize
self._a. (I realize this may well not be a trivial request.)
--
Skip Montanaro - skip at pobox.com - http://www.webfast.com/~skip/
More information about the Python-Projects
mailing list