# [Python-ideas] Dict joining using + and +=

Fri Mar 1 09:38:29 EST 2019

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".

Regards,

2019年3月1日(金) 23:19 Ivan Levkivskyi <levkivskyi at gmail.com>:

> On Fri, 1 Mar 2019 at 13:48, INADA Naoki <songofacandy at gmail.com> wrote:
>
>> >
>> >
>> > Is that an invariant you expect to apply to other uses of the +
>> > operator?
>> >
>> > py> x = -1
>> > py> x <= (x + x)
>> > False
>> >
>> > py> [999] <= ([1, 2, 3] + [999])
>> > False
>> >
>>
>> Please calm down.  I meant each type implements "sum"
>> in semantics of the type, in lossless way.
>> What "lossless" means is changed by the semantics of the type.
>>
>> -1 + -1 = -2 is sum in numerical semantics.  There are no loss.
>>
>
> TBH I don't understand what is lossless about numeric addition. What is
> the definition of lossless?
> Clearly some information is lost, since you can't uniquely restore two
> numbers you add from the result.
>
> Unless you define what lossless means, there will be just more
> misunderstandings.
>
> --
> Ivan
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190301/8d11d4f1/attachment.html>