July 28, 2014
1:26 a.m.
On 27 July 2014 02:17, Steven D'Aprano <steve@pearwood.info> wrote:
On Sun, Jul 27, 2014 at 09:34:16AM +1000, Alexander Heger wrote:
Is there a good reason for not implementing the "+" operator for dict.update()? [...] That is
B += A
should be equivalent to
B.update(A)
You're asking the wrong question. The burden is not on people to justify *not* adding new features, the burden is on somebody to justify adding them. Is there a good reason for implementing the + operator as dict.update?
One good reason is that people are still convinced "dict(A, **B)" makes some kind of sense. But really, we have collections.ChainMap, dict addition is confusing and there's already a PEP (python.org/dev/peps/pep-0448) that has a solution I prefer ({**A, **B}).