lists in dictonaries ?

Erik Max Francis max at alcyone.com
Thu Sep 19 23:35:39 CEST 2002


Manuel Hendel wrote:

> Is it possible to put lists in dictionaries?

I presume you mean as dictionary keys, since any Python object can be a
dictionary value.  Dictionary keys must be immutable objects (they must
define a hash function); lists are not immutable, but tuples are.

> And is it also possible
> to put multiple lists in a dictionary for one key?

I'm not sure what this means.  Tuples can contain tuples as elements, so
you could always make a higher-level tuple out of the tuples you want to
has as "one key," if that's what you mean.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ People are taught to be racists.
\__/ Jose Abad
    Fauxident / http://www.alcyone.com/pyos/fauxident/
 A "faux" ident daemon in Python



More information about the Python-list mailing list