3 ms·
> 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
by dragonwriter 3y ago
> 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:
[[] for _ in range(4)]