Death to tuples!

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Mon Nov 28 03:23:31 EST 2005


Mike Meyer enlightened us with:
> Is there any place in the language that still requires tuples
> instead of sequences, except for use as dictionary keys?

Anything that's an immutable sequence of numbers. For instance, a pair
of coordinates. Or a value and a weight for that value.

> If not, then it's not clear that tuples as a distinct data type
> still serves a purpose in the language. In which case, I think it's
> appropriate to consider doing away with tuples.

I really disagree. There are countless examples where adding or
removing elements from a list just wouldn't be right.

> The new intended use is as an immutable sequence type, not a
> "lightweight C struct".

It's the same, really. A lightweight list of elements, where each
element has its own meaning, is both an immutable sequence as well as
a lightweight C struct.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa



More information about the Python-list mailing list