Author rhettinger
Recipients ncoghlan, python-dev, rhettinger, serhiy.storchaka
Date 2015-01-04.02:39:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1420339152.83.0.524143236265.issue23132@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks Serhiy.  I really like this clean-up.  When there is an exception in the user's root comparison operation, the traceback is more intelligible now.

If you're interested, here are two additional optimizations:

_op_or_eq = '''                                                 
    op_result = self.%s(other)
    # Since bool(NotImplemented) is true, the usual special case test isn't needed here
    return op_result or self == other                           
'''

# setting NotImplemented as a local constant saves one or two global lookups per call
exec('def %s(self, other, NotImplemented=NotImplemented):%s' % (opname, opfunc % root), namespace)
History
Date User Action Args
2015-01-04 05:39:22rhettingerunlinkissue23132 messages
2015-01-04 02:39:13rhettingersetrecipients: + rhettinger, ncoghlan, python-dev, serhiy.storchaka
2015-01-04 02:39:12rhettingersetmessageid: <1420339152.83.0.524143236265.issue23132@psf.upfronthosting.co.za>
2015-01-04 02:39:12rhettingerlinkissue23132 messages
2015-01-04 02:39:11rhettingercreate