performance of tuple-less Python?

Gordon McMillan gmcm at
Mon Nov 29 19:06:33 CET 1999

François Pinard wrote:

> "Greg Wilson" <gvwilson at> writes:
> > [...] the use of tuples (which I believe are conceptually
> > redundant) [...]
> Tuples may be used to index within dictionaries, and I find this
> feature very useful.  Lists may not.  I do not know the
> implementation details, but would be tempted to have the
> prejudice (:-) that using lists to index would imply some severe
> performance penalty.

I'm guessing that not being able to find something you stuck 
in the dictionary qualifies as a performance penalty ;-).

To spell it out:
 1) hash based on id(list_object):
     d = {[1] = 'x'}
     d[[1]] -> KeyError
 2) hash based on value:
     lst = [1]
     d[lst] = 'x'
     d[lst] -> KeyError

- Gordon

More information about the Python-list mailing list