__lt__ slowing the "in" operator even if not called
Emanuele Aina
emanuele.aina at gmail.com
Thu Jun 15 18:56:02 EDT 2006
andrewdalke at gmail.com dettagliò:
> > Someone can explain me why?
>
> The list's __contains__ method is very simple
[...]
> So if you define "__lt__" in your object then the type gets a richcmp
> function and your == test implicit in the 'in' search always incurs the
> cost of figuring out that "__eq__" is not defined.
Thank you for the detailed explanation! :)
Do you think I should report this as a performance bug, maybe with the
'wishlist' priority, or I should accept the truth and hope for better
luck next time? ;)
More information about the Python-list
mailing list