return self other class commuter def __init__(selfval)self val val def __add__(selfother)print('add'self valotherreturn self val other __radd__ __add__ aliascut out the middleman in all theseright-side instance appearances trigger the singleshared __add__ methodpassing the right operand to selfto be treated the same as left-side appearance run these on your own for more insighttheir returned values are the same as the original propagating class type in more realistic classes where the class type may need to be propagated in resultsthings can become trickiertype testing may be required to tell whether it' safe to convert and thus avoid nesting for instancewithout the isinstance test in the followingwe could wind up with commuter whose val is another commuter when two instances are added and __add__ triggers __radd__class commuter def __init__(selfval)self val val def __add__(selfother)if isinstance(othercommuter )other other val return commuter (self val otherdef __radd__(selfother)return commuter (other self valdef __str__(self)return 'self val from commuter import commuter commuter ( commuter ( print( print( yz print(zprint( print( zprint( propagate class type in results type test to avoid object nesting else result is another commuter result is another commuter instance not nesteddoesn' recur to __radd__ the need for the isinstance type test here is very subtle--uncommentrunand trace to see why it' required if you doyou'll see that the last part of the preceding test right-side and in-place uses__radd__ and __iadd__