[Python-ideas] Adding "+" and "+=" operators to dict
Ethan Furman
ethan at stoneleaf.us
Fri Feb 13 01:21:10 CET 2015
On 02/12/2015 04:19 PM, Eric Snow wrote:
> 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.
Like __add__, for example? ;)
--
~Ethan~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150212/62d81a99/attachment.sig>
More information about the Python-ideas
mailing list