Executing global code
Peter Otten
__peter__ at web.de
Thu Jan 15 11:50:54 EST 2009
Jakub Debski wrote:
> Is it possible to execute global code (module-level code) more than
> once keeping the state of global variables? This means no reload() and
> no moving the code to a function.
You have a module containing e. g. these two statements
x = 42
x += 1
and want to rerun it with the effect of x becoming 44? That is not possible
because in Python
x = 42
is a statement, too, and will thus be rerun.
Peter
More information about the Python-list
mailing list