[issue38458] lists

2019-10-12 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +pablogsal ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue38458] lists

2019-10-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, it is part of the design of the language. Assignment in Python does not make a copy of lists, or any other object. In your sample code, p and l are two names for the same list, like "Devor Blake Daniels" and "dev40573" are two names for t

[issue38458] lists

2019-10-12 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- nosy: -pablogsal ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

[issue38458] lists

2019-10-12 Thread Pablo Galindo Salgado
Pablo Galindo Salgado 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

[issue38458] lists

2019-10-12 Thread DEVOR BLAKE DANIELS
New submission from DEVOR BLAKE DANIELS : l=[2,3,4] p=l p[0]=5 when I change p[0] to 5,l[0] is also changed to 5. I use slicing to get around this ,but when dealing with lists like s[][],slicing does not work -- files: three.py messages: 354558 nosy: dev40573 priority: normal severity: