Death to tuples!

sluggoster at gmail.com sluggoster at gmail.com
Tue Nov 29 08:53:42 EST 2005


Having a general frozen() system makes a lot of sense.  People use
tuples for two different things: as a lightweight record type (e.g.,
(x, y) coordinate pairs), and as an immutable list.  The latter is not
officially sanctioned but is widely believed to be the purpose for
tuples.  And the value of an immutable list is obvious: you can use it
as a constant or pass it to a function and know it won't be abused.  So
why not an immutable dictionary too?  There are many times I would have
preferred this if it were available.  frozen() is appealing because it
provides a general solution for all container types.

I'm not sure tuple should be eliminated, however.  It still has value
to show that these things are a group.  And it's very lightweight to
construct.

-- Mike Orr <sluggoster at gmail.com>




More information about the Python-list mailing list