[Python-ideas] Adding "+" and "+=" operators to dict
Eric Snow
ericsnowcurrently at gmail.com
Fri Feb 13 01:19:10 CET 2015
On Thu, Feb 12, 2015 at 4:29 PM, Donald Stufft <donald at stufft.io> wrote:
>> On Feb 12, 2015, at 6:28 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
>> copy-and-update:
>>
>> dict(old_dict, **other_dict)
>
> Only works if other_dict’s keys are all valid keyword arguments and AFAIK is considered an implementation detail of CPython.
Fair point. It seems to me that there is definitely enough interest
in a builtin way of doing this. My vote is for a dict classmethod.
-eric
More information about the Python-ideas
mailing list