trying to modify locals() dictionary

2009-01-12 Thread TP
Hi everybody, I try to modify locals() as an exercise. According to the context (function or __main__), it works differently (see below). Why? Thanks Julien def try_to_modify_locals( locals_ ): locals_[ a ] = 2 print locals_[ 'a' ]=, locals_[ a

Re: trying to modify locals() dictionary

2009-01-12 Thread Christian Heimes
TP schrieb: Hi everybody, I try to modify locals() as an exercise. According to the context (function or __main__), it works differently (see below). Why? Thanks Because http://docs.python.org/library/functions.html#locals Warning The contents of this dictionary should not be modified;

Re: trying to modify locals() dictionary

2009-01-12 Thread Albert Hopkins
On Mon, 2009-01-12 at 19:51 +0100, TP wrote: Hi everybody, I try to modify locals() as an exercise. According to the context (function or __main__), it works differently (see below). Why? Thanks Julien Per the locals() documentation @ http://docs.python.org/library/functions.html