[Python-ideas] PEP: Dict addition and subtraction

David Foster davidfstr at gmail.com
Tue Mar 5 00:37:54 EST 2019

I have seen a ton of discussion about what dict addition should do, but 
have seen almost no mention of dict difference.

This lack of discussion interest combined with me not recalling having 
needed the proposed subtraction semantics personally makes me wonder if 
we should hold off on locking in subtraction semantics just yet. Perhaps 
we could just scope the proposal to dictionary addition only for now?

If I *were* to define dict difference, my intuition suggests supporting 
a second operand that is any iterable of keys and not just dicts. 
(Augmented dict subtraction is already proposed to accept such a broader 
second argument.)

David Foster | Seattle, WA, USA

On 3/1/19 8:26 AM, Steven D'Aprano wrote:
> Attached is a draft PEP on adding + and - operators to dict for
> discussion.
> This should probably go here:
> https://github.com/python/peps
> but due to technical difficulties at my end, I'm very limited in what I
> can do on Github (at least for now). If there's anyone who would like to
> co-author and/or help with the process, that will be appreciated.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/

More information about the Python-ideas mailing list