Steven Bethard wrote: >>>>>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
yup. and to figure out why things are done this way, consider this case: >>> a = give_me_a_huge_tuple() >>> len(a) (a rather large number) >>> b = a[:2] >>> del a (IIRC, I proposed to add "substrings" when I implemented the Unicode string type, but that idea was rejected, for the very same "and how do you get rid of the original object" reason) </F> -- http://mail.python.org/mailman/listinfo/python-list