This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients Dennis Sweeney, glyph, rhettinger
Date 2021-08-05.23:29:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1628206145.33.0.307122478051.issue44605@roundup.psfhosted.org>
In-reply-to
Content
[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.
History
Date User Action Args
2021-08-05 23:29:05rhettingersetrecipients: + rhettinger, glyph, Dennis Sweeney
2021-08-05 23:29:05rhettingersetmessageid: <1628206145.33.0.307122478051.issue44605@roundup.psfhosted.org>
2021-08-05 23:29:05rhettingerlinkissue44605 messages
2021-08-05 23:29:05rhettingercreate