help me

Andrew Dalke adalke at mindspring.com
Sat Oct 9 23:26:17 EDT 2004


dataangel wrote:
> Well, I remember looking up the exec keyword and it saying executes a 
> string. Thus, it seemed like the normal way to execute a string, lol.

But why did that seem like it should be the normal way
to do variable assignment to global?

BTW, locals() doesn't work like you want in part because
that prevents a performance optimization where local
variable lookups are done in O(1) time as an offset
into a fixed size table.  I suppose it would be possible
to have locals() be able to manipulate that table behind
the scenes, but then that would be complicated and complex.

				Andrew
				dalke at dalkescientific.com



More information about the Python-list mailing list