Diez B. Roggisch wrote: > >>> Read the comments. What you say is essentially the same - the data >>> matters, after all. What do you care if there are several instances >>> around? >>> >> In my case it matters more that the objects are the same. >> >> For example I want set([Spam(1), Spam(2), >> Spam(3)]).intersect(set([Spam(1), Spam(2)]) to contain two items instead >> of 0. >> >> For this and many other reasons it's important that Spam(n) is Spam(n). > > > Ah, ok. Well, you could always use the __hash__ method to ensure that - > might be better anyway, because then _you_ define what equality means. > But YMMV.
And the __cmp__ or __eq__/__ne__ methdos of course.... Diez -- http://mail.python.org/mailman/listinfo/python-list