[issue23824] in-place addition of a shadowed class field
Jethro
report at bugs.python.org
Wed Apr 1 02:01:07 CEST 2015
Jethro added the comment:
I'm not confused. In my first report, I have already explained why python behaves that way. My point is, this is not the right way to go. Because the very same self.tot in the in-place operation self.tot+=a is first resolved to be the class field, then an instance field. This is against any sensible design of a language. If this is OK, then my second example should also be OK. In my second example, tot += x, the very same tot can be first resolved to the global variable tot, then the result is assigned to a local variable.
----------
resolution: not a bug ->
status: closed -> open
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23824>
_______________________________________
More information about the Python-bugs-list
mailing list