
12 Mar
2019
12 Mar
'19
11:34 a.m.
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