0

RXOR

what does rxor stands for? i didn't get its explanation in the previous lesson. Thanks!

21st Dec 2016, 7:04 AM
Mary Grace Elisan
2 odpowiedzi
+ 1
"There is a second set of arithmetic special methods with reflected operands." http://www.diveintopython3.net/special-method-names.html That explains reflected operands, things that act like other classes, etc. https://docs.python.org/2.0/ref/numeric-types.html 'rxor' with 'reversed operands' is indicated just after the normal operations.
21st Dec 2016, 9:25 AM
Kirk Schafer
Kirk Schafer - avatar
0
So, to explain a bit better : suppose you want to compute a ^ b Python first checks if a defines a __xor__ method. Suppose it doesn't. Then Python checks whether b defines a __rxor__ method. If it doesn't, there is a type error.
22nd Dec 2016, 12:14 AM
Amaras A
Amaras A - avatar