This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gdr@garethrees.org
Recipients Joona Mörsky, gdr@garethrees.org, vaultah
Date 2017-12-01.12:04:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1512129877.94.0.213398074469.issue32194@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2017-12-01 12:04:37gdr@garethrees.orgsetrecipients: + gdr@garethrees.org, vaultah, Joona Mörsky
2017-12-01 12:04:37gdr@garethrees.orgsetmessageid: <1512129877.94.0.213398074469.issue32194@psf.upfronthosting.co.za>
2017-12-01 12:04:37gdr@garethrees.orglinkissue32194 messages
2017-12-01 12:04:37gdr@garethrees.orgcreate