Andrii V. Mishkovskyi <[EMAIL PROTECTED]> added the comment:

This is covered in section 3.4.7 of Python Reference Manual:
__radd__(self, other)
[skipped]
    These methods are called to implement the binary arithmetic
operations (+, -, *, /, %, divmod(), pow(), **, <<, >>, &, ^, |) with
reflected (swapped) operands. These functions are only called if the
left operand does not support the corresponding operation and the
operands are of different types.[3.3] For instance, to evaluate the
expression x-y, where y is an instance of a class that has an __rsub__()
method, y.__rsub__(x) is called if x.__sub__(y) returns NotImplemented. 
[3.3] For operands of the same type, it is assumed that if the
non-reflected method (such as __add__()) fails the operation is not
supported, which is why the reflected method is not called.

----------
nosy: +mishok13

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3178>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to