[Python-ideas] PEP: Dict addition and subtraction

Steven D'Aprano steve at pearwood.info
Thu Mar 21 12:42:00 EDT 2019

I'd like to make a plea to people:

I get it, there is now significant opposition to using the + symbol for 
this proposed operator. At the time I wrote the first draft of the PEP, 
there was virtually no opposition to it, and the | operator had very 
little support. This has clearly changed.

At this point I don't think it is productive to keep making subjective 
claims that + will be more confusing or surprising. You've made your 
point that you don't like it, and the next draft^1 of the PEP will make 
that clear.

But if you have *concrete examples* of code that currently is easy to 
understand, but will be harder to understand if we add dict.__add__, 
then please do show me!

For those who oppose the + operator, it will help me if you made it 
clear whether it is *just* the + symbol you dislike, and would accept 
the | operator instead, or whether you hate the whole operator concept 
regardless of how it is spelled.

And to those who support this PEP, code examples where a dict merge 
operator will help are most welcome!

^1 Coming Real Soon Now™.


More information about the Python-ideas mailing list