
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. We have at least one other precedent to consider:
{1} | {1.0} {1} {1.0} | {1} {1.0}
I have absolutely no doubt that these kinds of questions will be thoroughly hashed out (multiple times, even) before the PEP gets to pronouncement. ChrisA