Steven Bethard wrote:
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)
Ahh. Yeah, that seems sensible. I don't think I've ever written code like that, but if I did, I'd almost certainly want it to work as it does now...
Steve -- http://mail.python.org/mailman/listinfo/python-list