dictionary with complex keys

Alex cut_me_out at hotmail.com
Tue Jun 6 17:05:45 EDT 2000


> I'm trying to create a dictionary with the keys being lists.

Can you use tuples instead of lists?  That will work?

Hashing lists is kind of strange, because the list contents can change
arbitrarily, and you would have to have a hash value that was invariant
under those changes.  You could use the value of id (list) or something,
but then two lists with identical elements would not necessarily map to
the same hash value.

Alex.



More information about the Python-list mailing list