Re: Using Dictionaries in Sets - dict objects are unhashable?

2006-03-22 Thread Gregory Piñero
Thanks guys. That was informative and helpful. I'm back on track now. -Greg On 21 Mar 2006 17:30:47 -0800, Ben Cartwright <[EMAIL PROTECTED]> wrote: > Gregory Piñero wrote: > > Hey guys, > > > > I don't understand why this isn't working for me. I'd like to be able > > to do this. Is there an

Re: Using Dictionaries in Sets - dict objects are unhashable?

2006-03-21 Thread Ben Cartwright
Gregory Piñero wrote: > 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 "", li

Re: Using Dictionaries in Sets - dict objects are unhashable?

2006-03-21 Thread Jonathan Gardner
Welcome to Python, where all types are either static (and thus hashable) or volatile (and thus not hashable.) The way hash tables work (which is what powers the set and dict types), you have to be able to get a number from an instance of the type, with the following conditions true: (1) Every equ

Using Dictionaries in Sets - dict objects are unhashable?

2006-03-21 Thread Gregory Piñero
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 "", line 1, in ? TypeError: dict objects are