Operator commutativity

Paul Rudin paul.nospam at rudin.co.uk
Mon Sep 19 07:23:48 EDT 2011


Henrik Faber <hfaber at invalid.net> writes:


> How can I make this commutative?

Incidentally - this isn't really about commutativity at all - the
question is how can you define both left and right versions of add,
irrespective of whether they yield the same result.

I think __radd__ is what you're after.



More information about the Python-list mailing list