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 |
| appeared in | <not specified> |
| done in | 0.25.2 |
| load | 0.200 |
| load left | 0.200 |
| closed by | <not specified> |


#6954 false "Using variable before assignment" on one-liner with-statements
Comments
-
2011/09/26 03:50, written by anon
| reply to this comment
(add comment)I just stumbled upon this problem as well. This is makes W0212 almost useless. Assigning is a lot worse then reading.