This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients brandtbucher, gvanrossum, rhettinger, serhiy.storchaka, xtreak
Date 2019-02-28.08:23:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1551342190.96.0.665487765904.issue36144@roundup.psfhosted.org>
In-reply-to
Content
> In Python, the plus operator for sequences (strings, lists, 
> tuples) is non-commutative.

For sequences, that is obvious and expected, but not so much with mappings where the order of overlapping keys is determined by the left operand and the value associated with those keys is determined by the right operand.

Also with sequences the + operator actually means "add to", but with dictionaries it means "add/or replace" which is contrary to the normal meaning of plus.  I think that was one of Guido's reasons for favoring "|" instead of "+" for set-to-set operations.

> We already have a syntax for dict merging: {**d1, **d2}. 
> It works with arbitrary mappings,

This is a good point.
History
Date User Action Args
2019-02-28 08:23:10rhettingersetrecipients: + rhettinger, gvanrossum, serhiy.storchaka, xtreak, brandtbucher
2019-02-28 08:23:10rhettingersetmessageid: <1551342190.96.0.665487765904.issue36144@roundup.psfhosted.org>
2019-02-28 08:23:10rhettingerlinkissue36144 messages
2019-02-28 08:23:10rhettingercreate