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

Stefan Behnel stefan_ml at behnel.de
Fri Apr 20 16:28:28 CEST 2012

Sven Marnach, 20.04.2012 15:37:
> Masklinn schrieb am Fri, 20. Apr 2012, um 14:47:34 +0200:
>> 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.)

Also, it's not immediately clear from the expression what happens for
duplicate keys, and the intended behaviour for that case may be different
from what the above does.


More information about the Python-ideas mailing list