Tuple comprehension

David Eppstein eppstein at ics.uci.edu
Thu Apr 11 22:54:52 EDT 2002


In article <slrnabchgs.c8l.mlh at vier.idi.ntnu.no>,
 mlh at vier.idi.ntnu.no (Magnus Lie Hetland) wrote:

> I think the only _real_ reason to have tuples at all is that they are
> immutable (and therefore usable as dictionary keys). And a slight
> efficiency advantage over lists, maybe...

I'm guessing (without looking at the source) that tuples use less memory 
because they don't need the extra room for growth that lists do.
But my mental model of them is just "immutable list".
Which as you say is important for use in dictionaries...

-- 
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/



More information about the Python-list mailing list