Message336812
| Author | serhiy.storchaka |
|---|---|
| Recipients | brandtbucher, gvanrossum, rhettinger, serhiy.storchaka, xtreak |
| Date | 2019-02-28.07:52:06 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1551340326.74.0.909745187914.issue36144@roundup.psfhosted.org> |
| In-reply-to |
| Content | |
|---|---|
> * 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. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-02-28 07:52:06 | serhiy.storchaka | set | recipients: + serhiy.storchaka, gvanrossum, rhettinger, xtreak, brandtbucher |
| 2019-02-28 07:52:06 | serhiy.storchaka | set | messageid: <1551340326.74.0.909745187914.issue36144@roundup.psfhosted.org> |
| 2019-02-28 07:52:06 | serhiy.storchaka | link | issue36144 messages |
| 2019-02-28 07:52:06 | serhiy.storchaka | create | |