Name

__radd__, __rdiv__, __rmod__, __rmul__, __rsub__

Synopsis

__radd__(self,other)
__rdiv__(self,other)
__rmod__(self,other)
__rmul__(self,other)
__rsub__(self,other)

Operators y + x, y / x, y % x, y * x, and y - x, respectively, call these methods when y doesn’t have a needed method __add__, __div__, and so on.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.