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

I would definitely include the example you alluded to in the operators thread:

Before:

tmp = keep.copy()
tmp.update(separate)
result = function(param=tmp)
del tmp

After:

result = f(param=keep+separate)

Thanks for drafting the PEP for this. There seems to be a bit of an echo in these 5+ threads, and your commentary has definitely been more constructive/original than most. Looking forward to the next revision!

Brandt

On Thu, Mar 21, 2019 at 9:42 AM Steven D'Aprano <steve@pearwood.info> wrote:
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™.


--
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/