Author calvin
Recipients calvin
Date 2008-02-13.14:51:14
SpamBayes Score 0.0429892
Marked as misclassified No
Message-id <1202914275.65.0.0408321545289.issue2102@psf.upfronthosting.co.za>
In-reply-to
Content
Hi,

the attached code in t.py fails to run:
class C (object):
    def __ror__ (self, other):
        return 42
print C() | C()

$ python t.py
Traceback (most recent call last):
  File "t.py", line 5, in ?
    print C() | C()
TypeError: unsupported operand type(s) for |: 'C' and 'C'

If I use old style classes (ie. "class C:" instead of "class
C(object):"), the code runs fine. I suspect that the method lookup for
special operator methods is different in new style classes, but why?
This might also be related to issue #643841 but I am not sure.
History
Date User Action Args
2008-02-13 14:51:16calvinsetspambayes_score: 0.0429892 -> 0.0429892
recipients: + calvin
2008-02-13 14:51:15calvinsetspambayes_score: 0.0429892 -> 0.0429892
messageid: <1202914275.65.0.0408321545289.issue2102@psf.upfronthosting.co.za>
2008-02-13 14:51:14calvinlinkissue2102 messages
2008-02-13 14:51:14calvincreate