Emanuele Aina wrote: > [EMAIL PROTECTED] 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? ;)
It certainly wouldn't hurt to report it. But I suspect it's not ever going to get "fixed". Classes with a __lt__ but no __eq__ really aren't that common. STeVe -- http://mail.python.org/mailman/listinfo/python-list