list vs tuple
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Sun Apr 1 07:36:01 EDT 2001
Sun, 01 Apr 2001 07:42:20 GMT, deadmeat <root@[127.0.0.1]> pisze:
> the first thing a newbie will do is play with simple integer
> values. a = 1;b = a; a = 2; leaves you with a and b of different
> values. So it appears b = a copies the value from b to a because
> changing a does not affect b.
It doesn't imply that. a=2 cannot change the value of b no matter what.
If = copies values, then b=a makes a copy of a and a=2 does not alter b.
If = copies references, then a=2 makes a new reference to 2. In neither
case a=2 changes the value of b, so how could you expect that? The
language would have to be inconsistent if a=2 changed b.
--
__("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTĘPCZA
QRCZAK
More information about the Python-list
mailing list