Creating variables from dicts

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Tue Feb 23 20:41:26 EST 2010


On Tue, 23 Feb 2010 15:41:16 -0800, Luis M. González wrote:

> By the way, if you want the variables inside myDict to be free
> variables, you have to add them to the local namespace. The local
> namespace is also a dictionary "locals()". So you can update locals as
> follows:
> 
>     locals().update( myDictionary )

No you can't. Try it inside a function.




-- 
Steven



More information about the Python-list mailing list