Re:Why Do Python Lists Multiply Oddly? Exploring the CPython...
by dragonwriter on Tuesday April 09, 2024 @12:45PM
(#39981270)
> There’s a separate type called tuple specifically designed to represent lists-as-values.
tuples are also references, but to an immutable object.
> If you do [()]*4 then you get exactly what you want.
I think what is actually wanted here is four different mutable lists rather than the same mutable list four times, something like what you would get from:
tuples are also references, but to an immutable object.
> If you do [()]*4 then you get exactly what you want.
I think what is actually wanted here is four different mutable lists rather than the same mutable list four times, something like what you would get from: