Author rhettinger
Recipients ncoghlan, python-dev, rhettinger, serhiy.storchaka
Date 2015-01-04.05:49:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1420350572.36.0.110042886835.issue23132@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-01-04 05:49:32rhettingersetrecipients: + rhettinger, ncoghlan, python-dev, serhiy.storchaka
2015-01-04 05:49:32rhettingersetmessageid: <1420350572.36.0.110042886835.issue23132@psf.upfronthosting.co.za>
2015-01-04 05:49:32rhettingerlinkissue23132 messages
2015-01-04 05:49:31rhettingercreate