Sets and Membership Tests
JKPeck
JKPeck at gmail.com
Tue Jul 11 22:17:04 EDT 2006
I would like to be able use sets where the set members are objects of a
class I wrote.
I want the members to be distinguished by some of the object content,
but I have not figured out how a set determines whether two (potential)
elements are identical. I tried implementing __eq__ and __ne__ and
__hash__ to make objects with identical content behave as identical for
set membership, but so far no luck.
I could subclass set if necessary, but I still don't know what I would
need to override.
TIA for any advice you can offer.
More information about the Python-list
mailing list