On Fri, 1 Mar 2019 at 14:50, Eric V. Smith <eric@trueblade.com> wrote:
On 3/1/2019 9:38 AM, INADA Naoki wrote:
> Sorry, I'm not good at English enough to explain my mental model.
>
> I meant no skip, no ignorance, no throw away.
>
> In case of 1+2=3, both of 1 and 2 are not skipped, ignored or thrown away.
>
> On the other hand, in case of {a:1, b:2}+{a:2}={a:2, b:2}, I feel {a:1}
> is skipped, ignored, or thrown away.  I used "lost" to explain it.
>
> And I used "lossless" for "there is no lost".  Not for reversible.
>
> If it isn't understandable to you, please ignore me.
>
> I think Rémi’s comment is very similar to my thought.  Merging mapping
> is more complex than concatenate sequence and it seems hard to call it
> "sum".

I understand Inada to be saying that each value on the LHS (as shown
above) affects the result on the RHS. That's the case with addition of
ints and other types, but not so with the proposed dict addition. As he
says, the {a:1} doesn't affect the result. The result would be the same
if this key wasn't present in the first dict, or if the key had a
different value.

This doesn't bother me, personally. I'm just trying to clarify.

OK, thanks for explaining! So more formally speaking, you want to say that for other examples of '+' in Python
x1 + y == x2 + y if and only if x1 == x2, while for the proposed '+' for dicts there may be many different x_i such that
x_i + y gives the same result.

This doesn't bother me either, since this is not a critical requirement for addition. I would say this is rather a coincidence
than a conscious decision.

--
Ivan