Serhiy Storchaka <[email protected]> added the comment:
> * It is natural to expect the plus operator to be commutative, but this
> operation would necessarily be non-commutative.
In Python, the plus operator for sequences (strings, lists, tuples) is
non-commutative.
But I have other arguments against it:
* It conflicts with the plus operator of Counter (which is a specialized dict):
Counter(a=2) + Counter(a=3) == Counter(a=5), but the proposed idea makes
dict(a=2) + dict(a=3) == dict(a=3).
* We already have a syntax for dict merging: {**d1, **d2}. It works with
arbitrary mappings, in contrary to the plus operator, which needs a special
support in argument types.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36144>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com