Meaning of __rlshift__ and __rrshift__ ?

Hamish Lawson hamish_lawson at yahoo.co.uk
Sat Apr 8 02:04:46 CEST 2000


__rrshift__ is the reversed-operand version of __rshift__. There
are reversed-operand versions of the other binary operators.
They are invoked for the object on the right-hand side of a
binary operator when the left-hand-side object doesn't support
the operator in question.

For example, consider the expression

    x / y

If x has a __div__() method defined then x.__div__(y) will be
invoked. But if x doesn't have __div__() defined then an attempt
will be made to invoke y.__rdiv__(x) instead.

Hamish Lawson


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!




More information about the Python-list mailing list