3 ms·
Everything falls in place when you accept that in python all names (including list indexes) are just pointers to an object, and objects aren't copied unless you
by scbrg 3y ago
Everything falls in place when you accept that in python all names (including list indexes) are just pointers to an object, and objects aren't copied unless you explicitly copy them. Everything else follows from that.
If you had done [1] * 4 you'd ended up with a list of four references to the same object (1) as well. It's just that 1 isn't mutable, so nobody cares.
- deleted 3y ago[deleted]