Raymond Hettinger added the comment:

Serhiy, this is a really nice idea.  By removing the additional layer of 
indirection, the code is more intelligible, runs faster, and the tracebacks 
make more sense when the user's root comparison raises an exception.

Since there are only twelve functions involved, I don't think the function 
templates give us much of a payoff.  Instead, it would be better to just 
precompute the 12 functions rather than have 5 templates.

I've attached a patch relative to Python 3.4.  Ideally, I would like this 
backported to 3.4 to fix the regression in performance and intelligibility.

One further possible change is to localize the NotImplemented global variable.  
This will reduce the overhead of NotImplemented checking to almost nothing and 
almost completely restore the performance of earlier versions.

----------
Added file: http://bugs.python.org/file37591/total_ordering.diff

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

Reply via email to