Instead of comparing integers:

> x = 1
> y = x  # does assignment make copies?
> y += 1
> assert x == 1
> => succeeds, which implies that Python makes a copy when assigning

with lists:

> x = [1]
> y = x  # does assignment make copies?
> y += [1]
> assert x == [1]
> => fails, which implies that Python uses references when assigning

Compare lists with tupels:

x = (1,)
y = x  # does assignment make copies?
y += (1,)
assert x == (1,)
=> succeeds, which implies *what*?

Regards,
Peter

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to