Message354561
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 the same person (you).
You can use slicing to make a copy of the list, or the copy module, or the list constructor.
I don't understand your comment "when dealing with lists like s[][],slicing does not work". |
|
Date |
User |
Action |
Args |
2019-10-13 00:44:16 | steven.daprano | set | recipients:
+ steven.daprano, dev40573 |
2019-10-13 00:44:16 | steven.daprano | set | messageid: <1570927456.17.0.430647374722.issue38458@roundup.psfhosted.org> |
2019-10-13 00:44:16 | steven.daprano | link | issue38458 messages |
2019-10-13 00:44:16 | steven.daprano | create | |
|