nice python solution
Tom Loredo
loredo at astro.cornell.edu
Tue Nov 20 22:46:03 EST 2001
Steve Holden wrote:
>
> > locals()[['a','b'][idx]] = val
> >
> This is absolutely verboten. I quote from Section 2.3 of the 2.0 manual, but
> I don't think anything has changed since: """locals ()
> Return a dictionary representing the current local symbol table. Warning:
> The contents of this dictionary should not be modified; changes may not
> affect the values of local variables used by the interpreter.
> """
But the code only modifies one of the references "a" or "b", not
the locals dictionary. Or am I missing something?
-Tom Loredo
More information about the Python-list
mailing list