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.

classification
Title: list.pop() removes items from multiple lists
Type: behavior Stage: resolved
Components: IDLE, Windows Versions: Python 3.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: annoywife, paul.moore, r.david.murray, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2015-07-24 02:41 by annoywife, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg247239 - (view) Author: (annoywife) Date: 2015-07-24 02:41
When executing the following code, I would expect the 3 to be removed from "list_copy" while "list_original" remains unaltered.  However, list_copy.pop() removes the 3 from both lists.  If an index is specified for pop, this behavior occurs as well.

list_original = [1,2,3]
list_copy = list_original
list_copy.pop()

Please let me know if I can provide any other information.
msg247240 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-07-24 03:09
https://docs.python.org/3/faq/programming.html#why-did-changing-list-y-also-change-list-x
History
Date User Action Args
2022-04-11 14:58:19adminsetgithub: 68889
2015-07-24 03:09:58r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg247240

resolution: not a bug
stage: resolved
2015-07-24 02:41:18annoywifecreate