trying to modify locals() dictionary

Christian Heimes lists at cheimes.de
Mon Jan 12 14:08:38 EST 2009


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; changes may not
affect the values of local variables used by the interpreter.

Christian




More information about the Python-list mailing list