On 19.09.2011 13:23, Paul Rudin wrote: > Henrik Faber <hfa...@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.
Right. The operator+ in my case just happens to be commutative and I wanted a language way to express this. > I think __radd__ is what you're after. It is, thank you very much - I knew there was some way to get this done nicely. Perfect! :-) Best regards, Henrik -- http://mail.python.org/mailman/listinfo/python-list