[Python-ideas] Have dict().update() return its own reference.

Alexander Belopolsky alexander.belopolsky at gmail.com
Fri Apr 20 16:35:55 CEST 2012


On Fri, Apr 20, 2012 at 9:37 AM, Sven Marnach <sven at marnach.net> wrote:
>> If you start from dict instances, you could always use:
>>
>>     merged = dict(x, **y)
>
> No, not always.  Only if all keys of `y` are strings (and probably
> they should also be valid Python identifiers.)

>>> a = {}
>>> b = {1:2}
>>> dict(a, **b)
{1: 2}



More information about the Python-ideas mailing list