Using Dictionaries in Sets - dict objects are unhashable?

Gregory Piñero gregpinero at
Wed Mar 22 01:28:16 CET 2006

Hey guys,

I don't understand why this isn't working for me.  I'd like to be able
to do this.  Is there another short alternative to get this

[Dbg]>>> set([{'a':1},{'b':2}]).intersection([{'a':1}])
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
TypeError: dict objects are unhashable

(Bonus points: Why does anything have to be "hashed"?  Can't it just
check the references?)


Gregory Piñero
Chief Innovation Officer
Blended Technologies

More information about the Python-list mailing list