[Python-ideas] PEP: Dict addition and subtraction

Jonathan Fine jfine2358 at gmail.com
Thu Mar 21 17:44:01 EDT 2019


Antoine Pitrou wrote:
> Note that, if you're able to live with a third-party dependency, the
> `toolz` package has what you need (and lots of other things too):
> https://toolz.readthedocs.io/en/latest/api.html#toolz.dicttoolz.merge

I suggest that the supporters of dict + dict make (and put up on PyPi)
a pure-Python subclass of dict that has the desired properties. This
would

1. Clarify and document the syntax and semantics.
2. Help with exploration and testing.
3. Provide a 'back-port' mechanism to current Python.
4. Give the proposal the benefit of practical experience.

I find this last very important, when we can do it. And we can, in
this case. Language changes are 'cast in stone' and hard to reverse.
And afterwards, on this list, we're sometime told that we've 'missed
the boat' for a particular change.

Let's take the benefit of a reference pure Python implementation, when we can.

Steven D'A. Please would you include or respond to this suggestion, in
the next revision of the PEP.

-- 
Jonathan


More information about the Python-ideas mailing list