
On Fri, Mar 1, 2019 at 9:47 PM Chris Angelico <rosuav@gmail.com> wrote:
On Fri, Mar 1, 2019 at 11:00 PM INADA Naoki <songofacandy@gmail.com> wrote:
I dislike adding more operator overload to builtin types.
str is not commutative, but it satisfies a in (a+b), and b in (a+b). There are no loss.
In case of dict + dict, it not only sum. There may be loss value.
{"a":1} + {"a":2} = ?
In case of a.update(b), it's clear that b wins. In case of a + b, "which wins" or "exception raised on duplicated key?" is unclear to me.
Picking semantics can be done as part of the PEP discussion, and needn't be a reason for rejecting the proposal before it's even made.
Yes. I say just no semantics seems clear to me. I don't discuss which one is best. And I say only I dislike it. It must be free to express like or dislike, no?
We have at least one other precedent to consider:
{1} | {1.0} {1} {1.0} | {1} {1.0}
It is just because of behavior of int and float. It is not caused by set behavior. Set keeps "no loss" semantics when view of equality.
{1} <= ({1} | {1.0}) True {1.0} <= ({1} | {1.0}) True
So dict + dict is totally different than set | set. dict + dict has los at equality level. -- INADA Naoki <songofacandy@gmail.com>