Fredrik Lundh wrote:
George Sakkis wrote:

Why does slicing a tuple returns a new tuple instead of a view of the existing 
one, given that
tuples are immutable ?

really?


a = 1, 2, 3
b = a[:]
a is b
True

My impression was that full tuple copies didn't actually copy, but that slicing a subset of a tuple might. Not exactly sure how to test this, but:


py> a = 1, 2, 3
py> a[:2] is a[:2]
False

So _something_ at least is different between the two slices...

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

Reply via email to