[Python-ideas] dict.merge(d1, d2, ...) (Counter proposal for PEP 584)

Steven D'Aprano steve at pearwood.info
Fri Mar 22 00:53:51 EDT 2019


On Thu, Mar 21, 2019 at 09:36:20PM -0400, Terry Reedy wrote:

> I counted what I believe to be 10 instances of copy-update in the top 
> level of /lib.  Do either of you consider this to be enough that any 
> addition would be worthwhile.

I think you're referring to Guido and Antoine? But for what it's worth, 
I think that's a good indication that there are uses for a merge 
operator.

> There are 3 in idlelib that I plan to replace with {**a, **b} and be 
> done with the issue.  I did not check any other packages.

If a+b already worked for dicts, would you still prefer {**a, **b}?

How about if it were spelled a|b?



-- 
Steven


More information about the Python-ideas mailing list