[issue27668] list illogical affectation

SilentGhost report at bugs.python.org
Tue Aug 2 08:19:26 EDT 2016


SilentGhost added the comment:

Because elements of the tab list are the same list. And since list is a mutable type, modifying list object will be visible to via all the reference / names that point to that object. There are various ways to work around this behaviour, typically a list comprehension is used.

P.S. Please don't add spurious components to the issue, it adds people to the nosy list.

----------
components:  -IDLE, Macintosh
nosy: +SilentGhost
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27668>
_______________________________________


More information about the Python-bugs-list mailing list