Using Dictionaries in Sets - dict objects are unhashable?

Gregory Piñero gregpinero at gmail.com
Tue Mar 21 19:28:16 EST 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
intersection?

[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?)

Thanks,

--
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)



More information about the Python-list mailing list