[Python-ideas] Dict joining using + and +=

Christopher Barker pythonchb at gmail.com
Tue Mar 12 11:34:18 EDT 2019


> This question is probably on its own a valid argument against the
> proposal. When it comes to dicts (and not Mappings in general) {**d1,
> **d2} or d.update() already have clearly-defined semantics.


Actually, in my mind, this is an argument for an operator (or method) —
besides being obtuse, the {**d1,**d2} syntax only creates actual dicts. If
we had an operator defined for mappings in general, it would be easier to
duck type dicts.

I think this is pretty compelling, actually. And also an argument for aging
the operation return the type it was invoked on, rather than always a dict.

I can’t find the latest draft of the PEP, so I’m not sure if this is
discussed there. But it should be.

-CHB
-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190312/eb40599d/attachment.html>


More information about the Python-ideas mailing list