4 ms·
I don't find this convincing at all. > so that the addition works the same regardless of order, as exists for numeric types + is not commutative for lists, tu
by zestyping 8y ago
I don't find this convincing at all.
> so that the addition works the same regardless of order, as exists for numeric types
+ is not commutative for lists, tuples, or dicts. So the promotion process need not be commutative either. There is no good reason why list + tuple should be forbidden, or dict + items should be forbidden.
a [op]= b is commonly and easily explained as "a = a [op] b, where a is mutated in place". Python should not break that explanation with mysterious inconsistencies.
- dragonwriter 8y ago> + is not commutative for lists, tuples, or dicts Yeah, that's a good point. I think I was thinking on the type level rather than the value level, but I am unsure that makes a convincing argument for the behavior here even if it is otherwise true (which I’m not sure it is always, even at the type level.)