list vs tuple

Remco Gerlich scarblac at pino.selwerd.nl
Sun Apr 1 11:56:27 EDT 2001


deadmeat <root@[127.0.0.1]> wrote in comp.lang.python:
> > 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.

It does not. It merely makes the pointer 'a' point to the same thing 'b' is
pointing to. '=' never copies, that would be inconsistent.

-- 
Remco Gerlich



More information about the Python-list mailing list