"a in b" calls a.__cmp__, why?
Gerrit Holl
gerrit at nl.linux.org
Sun Jun 22 10:12:10 EDT 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.
yours,
Gerrit.
--
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:
http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
http://www.sp.nl/
More information about the Python-list
mailing list