Operator commutativity
Henrik Faber
hfaber at invalid.net
Mon Sep 19 07:32:00 EDT 2011
More information about the Python-list mailing list
Mon Sep 19 07:32:00 EDT 2011
- Previous message (by thread): Operator commutativity
- Next message (by thread): Operator commutativity
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 19.09.2011 13:23, Paul Rudin wrote: > 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. 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
- Previous message (by thread): Operator commutativity
- Next message (by thread): Operator commutativity
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list