On 17 mars 19:40, Andreas Maier wrote: > Hi, Hi,
> I am using PyLint 1.1.0 with Python 2.6, and found that the following > code does not raise E0203 "Access to member '%s' before its > definition line %s", as it should: > > class MyClass1(object): > def __init__(self): > self.first += 5 # Does not raise E0203 as it should > self.first = 0 > > Just for comparison, when omitting the straight assignment on the > second line of the method, message E1101 is raised, so the instance > attribute is (correctly) recognized to be read before the addition: > > class MyClass2(object): > def __init__(self): > self.first += 5 # Correctly raises E1101: > # Instance of 'MyClass2' has no > # 'first' member > > Also just for comparison, here is code that correctly raises E0203: > > class MyClass3(object): > def __init__(self): > self.first = self.sec # Correctly raises E0203: > # Access to member 'sec' before > # its definition line <N> > self.sec = 0 > > When researching this behavior, I seem to have found a notice somewhere > stating that the += operator is incorrectly not recognized by PyLint > as reading the value first, but I could not find the notice again, > nor could I find an entry for this issue in the (new) PyLint issues > list at https://bitbucket.org/logilab/pylint/issues/ > > My questions are: > * Should this be considered a bug in PyLint? > * If so, has this been reported already? IIRC it has indeed already been mentioned but I'm not sure there is a proper issue for it. And your report is nice, so please put it as an issue in bitbucket an mark it as important. Thx -- Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42) Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services CubicWeb, the semantic web framework: http://www.cubicweb.org _______________________________________________ code-quality mailing list code-quality@python.org https://mail.python.org/mailman/listinfo/code-quality