dictionary with complex keys

Aahz Maruch aahz at netcom.com
Tue Jun 6 15:52:40 EDT 2000


In article <393D54B6.EAF70234 at magellan.umontreal.ca>,
Stefan Seefeld  <seefelds at magellan.umontreal.ca> wrote:
>
>I'm trying to create a dictionary with the keys being lists.  How can I
>do that ? The docs say that only simple types are possible as keys. Is
>there a way to achieve what I want ? May be some special operator I
>need to define...

Use tuples instead of lists.  The restriction isn't so much on "simple"
types as "immutable" types -- dict keys must be constants.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"You could make Eskimos emigrate to the Sahara by vigorously arguing --
at hundreds of screens' length -- for the wonder, beauty, and utility of 
snow."  -- PNH to rb in r.a.sf.f



More information about the Python-list mailing list