setting variables in the local namespace
pavlovevidence at gmail.com
Tue Oct 13 22:47:40 CEST 2009
On Oct 13, 12:23 pm, Mick Krippendorf <mad.m... at gmx.de> wrote:
> Carl Banks schrieb:
> > Lemme guess.
> > You tried this at the interactive prompt and concluded it worked in
> > general, right?
> Yes. Thank you for enlighten me.
> > One of these days we're going to have a thread like this where no one
> > makes this mistake. Don't know when, but one day it will happen.
> But at least it will not be my mistake anymore.
One by one, baby. It just amazes me so many people don't think to
check inside a function, especially when we normally think of local
variables as being local to a function. If I wasn't familiar with
locals(), it probably wouldn't even occur to me to try using locals()
at the top level. I'd expect it to throw an exception like "No locals
at global level".
More information about the Python-list