[Python-ideas] Unpacking a dict

Ethan Furman ethan at stoneleaf.us
Thu May 26 23:05:09 EDT 2016


On 05/26/2016 07:57 PM, Chris Angelico wrote:
> On Fri, May 27, 2016 at 12:43 PM, Rob Cliffe wrote:

>> How about
>>
>>      locals().update(values)
>
> Because locals() can't be updated unless it happens to be the same
> dict as globals(), in which case it's clearer to use that name.

Actually, the dict returned by locals() can be updated, but at least in 
cPython those updates don't make it back to the function's locals 
(although they do in other Python's).

--
~Ethan~



More information about the Python-ideas mailing list