"a in b" calls a.__cmp__, why?

Gerrit Holl gerrit at nl.linux.org
Sun Jun 22 16:12:10 CEST 2003

Sets rule ok!

Gerrit Holl wrote:
> Ah, thanks... I'll override __eq__ then to compare by equality.
> > If you want identity in-ness, either program the search yourself or
> > use a list  (or dict/set) of ids and search for id(item) in idlist.
> > 
> > If your list is long (enough) and repeatedly searched, sorting and
> > using binsearch or making a set or dict for hash access will be
> > faster.
> I will try that.

Ah, Sets are much better, also in other places in my game. I was
already using them so I should have known them...

What is binsearch, actually? I wasn't able to find anything about
it on the www or usenet.


167. If a man marry a wife and she bear him children: if this wife die
and he then take another wife and she bear him children: if then the
father die, the sons must not partition the estate according to the
mothers, they shall divide the dowries of their mothers only in this way;
the paternal estate they shall divide equally with one another.
        -- 1780 BC, Hammurabi, Code of Law
Asperger Syndroom - een persoonlijke benadering:
Het zijn tijden om je zelf met politiek te bemoeien:

More information about the Python-list mailing list