pylint #7394 W0212 (access to protected member) not emited on assigments [validation pending]
Paul `Satoshi' Hachmann : Inline interpreted text or phrase reference start-string without end-string.In the following code, the '_secret' protected member of SomeClass is accessed twice; once to set it and another to print it: class SomeClass(object): def __init__(self): self._secret = 3 obj = SomeClass() obj._secret = 1 # Doesn't catch this! print "I am accessing", obj._secret # Produces W0212, as expected However, the assignment statement by itself doesn't generate a W0212. | |
priority | normal |
---|---|
type | bug |
done in | 0.25.2 |
load | 0.200 |
load left | 0.000 |
closed by | #40de65ba89b2 Add checking for protected attribute assignement, closes #7394. |
Comments
-
2011/09/26 01:50, written by anon
add commentI just stumbled upon this problem as well. This is makes W0212 almost useless. Assigning is a lot worse then reading.