Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

To add support for metaclasses, replacing 'self.__lt__(other)' with 
'type(self).__lt__(self, other)' will work. 

The performance degradation for the common case is about 25%:

$ py -m timeit -s 'from tmp import a, b' 'a >= b'     # op_result = 
type(self).__lt__(self, other)
1000000 loops, best of 5: 283 nsec per loop

$ py -m timeit -s 'from tmp import a, b' 'a >= b'     # op_result = 
self.__lt__(other)
1000000 loops, best of 5: 227 nsec per loop

----------

_______________________________________
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