Steven D'Aprano <[email protected]> added the comment:
This is not a bug, it is working correctly, as designed.
List multiplication does not *copy* the list, it replicates the reference to
the same list object. So [[0]]*5 does not make five different sublists, but the
same list repeated five times. Exactly the same as this:
a = [0]
mylist = [a, a, a, a, a]
----------
nosy: +steven.daprano
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43157>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com