Declaring variables from a list

Sidharth Kuruvila sidharth.kuruvila at gmail.com
Fri Apr 8 18:23:31 EDT 2005


What I gave was a bad solution. Something that works right now, but
probably shouldn't be done.

On Apr 9, 2005 3:37 AM, Inyeol Lee <inyeol.lee at siimage.com> wrote:
> On Sat, Apr 09, 2005 at 03:15:01AM +0530, Sidharth Kuruvila wrote:
> > Python has a builtin function called locals which returns the local
> > context as a dictionary
> >
> > >>> locals = locals()
> > >>> locals["a"] = 5
> > >>> a
> > 5
> > >>> locals["a"] = "changed"
> > >>> a
> > 'changed'
> 
> >From Python lib reference:
> 
> """
> locals()
>     ...
>     Warning: The contents of this dictionary should not be
>     modified; changes may not affect the values of local variables used
>     by the interpreter.
> """
> --
> http://mail.python.org/mailman/listinfo/python-list
> 


-- 
http://blogs.applibase.net/sidharth



More information about the Python-list mailing list