Glyph Lefkowitz <gl...@twistedmatrix.com> added the comment:

> Do you all have preference for 1) expanding the range of use cases to cover 
> metaclasses but incurring a performance hit for common cases, or 2) leaving 
> it as-is and documenting that it doesn't work for metaclasses?

If we do need the slow approach for the meta-type case, (i.e.: 
type(self).__lt__(other)) then why not decide on implementation at decoration 
time? The decorator has enough information to know if this strategy is 
necessary and can put different special methods in place.

(But also, wouldn't 'from operator import lt ... lt(self, other)' be a bit 
faster, and also more general, just because it's doing specialized dispatch in 
C rather than an additional Python function call / method dispatch?  I have not 
benchmarked myself, so please ignore if you've already tested this.)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44605>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to