__lt__ slowing the "in" operator even if not called

Maric Michaud maric at aristote.info
Thu Jun 15 08:24:17 EDT 2006


Le Jeudi 15 Juin 2006 14:14, Emanuele Aina a écrit :
> But I hoped in a more exaustive answer: why python has to do this
> lookup when the __lt__ method is not involved at all?

It is not the case, that's what my program shows :

<class '__main__.StateEQ'>

in operator at the beginning of list: 173
in operator at the end of list: 28249 <- here

converting to dict : 79
in operator for a dict for 60000 elements: 14

<class '__main__.StateLTEQ'>

in operator at the beginning of list: 202
in operator at the end of list: 30472 <- and here


-- 
_____________

Maric Michaud
_____________

Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097



More information about the Python-list mailing list