Multikey dictionary

Mark McEahern marklists at mceahern.com
Tue Jul 23 10:10:52 EDT 2002


> What datatypes can one use as key in a dictionary?

Look here for __hash__--that might help:

  http://www.python.org/doc/current/ref/customization.html

> Can I use for example two longs as key (kind of a double key)?

If you want to keep it simple, why not just use a tuple?

  d = {}
  d[(1,2)] = "foo"

// mark
-






More information about the Python-list mailing list