list vs tuple

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sat Mar 31 16:48:07 EST 2001


Sat, 31 Mar 2001 21:24:33 GMT, deadmeat <root@[127.0.0.1]> pisze:

> >>> a = 1
> >>> b = a
> >>> a = 2
> >>> b
> 1
> 
> >>> a = [1,2,3]
> >>> b = a
> >>> a[0] = 0
> >>> b
> [0, 2, 3]
> 
> Are you saying there is no difference (IN THE *RESULT*) between these?

Of course there is, because you assigned to 'a' in the first case
and to 'a[0]' in the second. How could the result be the same if
you execute different statements?

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list