list vs tuple

deadmeat root at [127.0.0.1]
Sat Mar 31 14:52:46 EST 2001


> The same statement behaves *exactly the same*.

No, it doesn't.

> It's the next statements
> (b[5] = 9, b = 9) that behave entirely differently.

Are you on crack?  a = b in the first example copies the data across. a = b
in the second points both a and b to the same space.  This is basic pointer
stuff in other languages - but since Python doesn't do that, one would
expect it to behave like it wasn't using pointers.

> b = 9 binds the variable
> b[5] = 9 is equivalent to b.__setitem__(5, 9)

Your point is what?






More information about the Python-list mailing list