In article <gt9t62$g6f$0...@news.t-online.com>, Peter Otten <__pete...@web.de> wrote: >Aahz wrote: >> In article <gt8v37$kib$0...@news.t-online.com>, >> Peter Otten <__pete...@web.de> wrote: >>>Aahz wrote: >>>> In article <gt1kb7$jqg$0...@news.t-online.com>, >>>> Peter Otten <__pete...@web.de> wrote: >>>>> >>>>>Here's a trick to find the actual element. I think Raymond Hettinger >>>>>posted an implementation of this idea recently, but I can't find it at >>>>>the moment. >>>> >>>> Your code is inverted from Raymond's: >>> >>>I can't see the inversion. >> >> You were wrapping the objects inserted into the set; Raymond's trick >> involved only wrapping the comparison object. It's therefore much more >> convenient. > >I think you are misreading my code. I took the items (of class X) as they >were specified by the OP. > >The reason I changed their __eq__() method is not that I did not understand >Raymond's trick, but rather a quirk in the set's item lookup:
Gotcha -- thanks for the explanation! -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." --Red Adair -- http://mail.python.org/mailman/listinfo/python-list