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

[Glyph]
> why not decide on implementation at decoration time?

We could do that and not incur performance issues.  However, it would expand 
the API and double the size of the code.  

We've had no other reports about this issue since total_ordering() was added in 
Python 2.7, nor have there been any questions about it on StackOverflow.  Do 
you think anyone other than yourself would use this feature?

It seems like a rare niche use case, and the workaround is simple.

For production code, I usually recommend writing out the other three methods 
(that is less magical, runs faster, easier to test, has fewer  dependencies, 
and makes the tracebacks more readable.

> (But also, wouldn't 'from operator import lt ... lt(self, other)'
> be a bit faster, and also more general, 

The lt() function emulates the '<' operator, so we still have the problems with 
reflection that we were trying to avoid by calling the __lt__ method directly.

----------

_______________________________________
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