Gareth Rees <g...@garethrees.org> added the comment:

The behaviour of the * operator (and the associated gotcha) is documented under 
"Common sequence operations" [1]:

    Note that items in the sequence s are not copied; they are referenced
    multiple times. This often haunts new Python programmers ...

There is also an entry in the FAQ [2]:

    replicating a list with * doesn’t create copies, it only creates
    references to the existing objects

[1] 
https://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range
[2] https://docs.python.org/3/faq/programming.html#faq-multidimensional-list

----------
nosy: +g...@garethrees.org
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32194>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to