Death to tuples!

Mike Meyer mwm at
Mon Nov 28 21:21:31 CET 2005

Steven Bethard <steven.bethard at> writes:
> Dan Bishop wrote:
>> Mike Meyer wrote:
>>>Is there any place in the language that still requires tuples instead
>>>of sequences, except for use as dictionary keys?
>> The % operator for strings.  And in argument lists.
>> def __setitem__(self, (row, column), value):
>>    ...
> Interesting that both of these two things[1][2] have recently been
> suggested as candidates for removal in Python 3.0.
> [1]
> [2]

#2 I actually mentioned in passing, as it's part of the general
concept of tuple unpacking. When names are bound, you can use a
"tuple" for an lvalue, and the sequence on the rhs will be "unpacked"
into the various names in the lvalue:

        for key, value = mydict.iteritems(): ...
        a, (b, c) = (1, 2), (3, 4)

I think of the parameters of a function as just another case of
this; any solution that works for the above two should work for
function paremeters as well.

Mike Meyer <mwm at>
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

More information about the Python-list mailing list