On 3/1/19 8:19 AM, Ivan Levkivskyi wrote:
On Fri, 1 Mar 2019 at 13:48, INADA Naoki <songofaca...@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.

I don't mean to put words into anyone's mouth, but I think I
see what IDANA Naoki means:  in other cases of summation,
the result somehow includes or contains both operands.  In
the case of summing dicts, though, some of the operands are
"lost" in the process.

I'm sure that I'm nowhere near as prolific as many of the
members of this list, but I don't remember ever merging
dicts (and a quick grep of my Python source tree confirms
same), so I won't comment further on the actual issue at
hand.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to