lists in dictonaries ?

Erik Max Francis max at
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 /
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ People are taught to be racists.
\__/ Jose Abad
    Fauxident /
 A "faux" ident daemon in Python

More information about the Python-list mailing list