[issue45169] Shallow copy occurs when list multiplication is used to create nested lists; can confuse users

2021-09-10 Thread 2106 Hyunwoo Oh
Change by 2106 Hyunwoo Oh : -- components: +Interpreter Core -Demos and Tools ___ Python tracker <https://bugs.python.org/issue45169> ___ ___ Python-bugs-list m

[issue45169] Shallow copy occurs when list multiplication is used to create nested lists; can confuse users

2021-09-10 Thread 2106 Hyunwoo Oh
New submission from 2106 Hyunwoo Oh : If you do the following: lists=[[]]*100 lists[1].append('text') print(lists[2]) you can see lists[2] contains 'text' even though it was appended to lists[1] in the text. A little more investigation with the id() function can show that the lists