On Fri, Mar 15, 2019 at 10:53:31PM +0000, MRAB wrote: > There was also the suggestion of having both << and >>. > > Actually, now that dicts are ordered, that would provide a use-case, > because you would then be able to choose which values were overwritten > whilst maintaining the order of the dict on the LHS.
Is that common enough that it needs to be built-in to dict itself? If it is uncommon, then the conventional solution is to subclass dict, overriding the merge operator to use first-seen semantics. The question this PEP is trying to answer is not "can we support every use-case imaginable for a merge operator?" but "can we support the most typical use-case?", which I believe is a version of: new = a.copy() new.update(b) # do something with new -- Steven _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/