Can't get items out of a set?
Cruxic
cruxic at gmail.com
Sat Mar 8 11:25:06 EST 2008
On Mar 7, 11:20 am, Raymond Hettinger <pyt... at rcn.com> wrote:
> [Cruxic]
>
> > Is it possible to get an object out of a set() given another object
> > that has the same hash code and equality (__hash__() and __eq__()
> > return the same)?
>
> Yes, but it requires an indirect approach.http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/499299
>
> Raymond
That's a clever work around. Thanks, Raymond. Clearly you had a need
for this. Do you feel it's a common need that should be submitted as
a Python feature request? To me it seems like such a simple thing
that would increase the general utility of the set class. I suppose I
could start another thread like "feature request: New method for set -
get_equivalent".
More information about the Python-list
mailing list