Death to tuples!
Duncan Booth
duncan.booth at invalid.invalid
Tue Nov 29 11:13:28 EST 2005
Dan Bishop 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):
> ...
>
Don't forget the exception specification in a try..catch statement:
> An object is compatible with an exception if it is either the object
> that identifies the exception, or (for exceptions that are classes) it
> is a base class of the exception, or it is a tuple containing an item
> that is compatible with the exception.
Requiring a tuple here means that the code doesn't have to worry about a
possible recursive data structure.
More information about the Python-list
mailing list