[Python-ideas] PEP: Dict addition and subtraction

James Lu jamtlu at gmail.com
Mon Mar 4 10:01:23 EST 2019

> On Mar 4, 2019, at 3:41 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> James Lu schrieb am 04.03.19 um 03:28:
>> I propose that the + sign merge two python dictionaries such that if there are conflicting keys, a KeyError is thrown.
> Please, no. That would be really annoying.
> If you need that feature, it can become a new method on dicts.
> Stefan
If you want to merge it without a KeyError, learn and use the more explicit {**d1, **d2} syntax.

More information about the Python-ideas mailing list