[issue38458] lists

Pablo Galindo Salgado report at bugs.python.org
Sat Oct 12 20:41:09 EDT 2019


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

Hi Devor,

This is not a bug in Python but indeed documented behavior. When you do

p=l

you are creating a new reference to the same list ([2,3,4]), so changing one changes the other. If you want to make a copy you can do

p = l.copy()

----------
nosy: +pablogsal
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38458>
_______________________________________


More information about the Python-bugs-list mailing list