[Python-ideas] Should this be considered a bug?

Nick Coghlan ncoghlan at gmail.com
Sun Oct 30 23:49:54 CET 2011


On Mon, Oct 31, 2011 at 8:40 AM, Arnaud Delobelle <arnodel at gmail.com> wrote:
> The convention in mathematics is that addition is commutative but
> there is no such assumption for multiplication.  In fact,
> multiplicative notation is commonly used for the composition law of
> non-commutative groups.
>
> Is there an established convention in computer languages?

I was referring to the definition of multiplication in ordinary
arithmetic (including complex numbers). Agreed that mathematicians in
general are quite happy to use it for other relations that don't align
with that definition.

> As for the commutativity of addition in python... well, string
> concatenation is not generally considered commutative :)

Yeah, I was really talking about commutativity of result types rather
than result values. The point about order mattering for values as soon
as sequences get involved is a fair one (IIRC, that's one of the
reasons set union uses '|' rather '+' - as a hint that the operation
*is* commutative, even though container addition normally isn't).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list