[Python-projects] pylint complains when initializing attribute via property()
Sylvain Thénault
sylvain.thenault at logilab.fr
Mon Jan 14 14:55:38 CET 2008
Hi Skip,
On Wed, Jan 09, 2008 at 11:40:37AM -0600, skip at pobox.com wrote:
>
> 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.)
I've no time to work on this right now, but I've added a ticket to the
project so we don't forget this: http://www.logilab.org/ticket/4593
Thanks for your report, regards
--
Sylvain Thénault LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Python et calcul scientifique: http://www.logilab.fr/science
More information about the Python-Projects
mailing list