Closed ozomer closed 11 years ago
I want to add some functionality using radd .
class MyClass(object): def __radd__(self, other): return 7
If I create a new MyClass object and get:
>>> c = Coo() >>> () + Coo() 7 >>> [] + Coo() 7 >>> blist.blist() + Coo() 7 >>> blist.btuple() + Coo() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.6/dist-packages/blist-1.3.4-py2.6-linux-i686.egg/_btuple.py", line 47, in __add__ raise TypeError TypeError
This happens because the add function returns raises TypeError instead of returning NotImplemeted, so the other object's radd is not called.
I want to add some functionality using radd .
If I create a new MyClass object and get:
This happens because the add function returns raises TypeError instead of returning NotImplemeted, so the other object's radd is not called.