[Tutor] Implementing sets of user-defined objects

mhw at doctors.net.uk mhw at doctors.net.uk
Fri Jul 23 13:22:55 CEST 2010


Dear Tutors,

I am tring to deal with some repeated data, and hence repeated objects (I construct objects from the data).

I had hoped to use a set to uniquify the objects. However, I am having problems with defining uniqueness.

I have googled/ looked at the Python docs/ read DITP and Alan's website, but I'm still not clear how the set() determines object uniqueness. There seem to be some references to __cmp__() and __eq__(), but I'm not clear what I should be using.

Any pointers very welcome.

Matt
Sent from my BlackBerry® wireless device


More information about the Tutor mailing list