Executing global code

Terry Reedy tjreedy at udel.edu
Thu Jan 15 22:23:33 CET 2009

Jakub Debski wrote:
> Hi,
> 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.

Wrap the code in a loop:

for dummy in range(<n>): # <n> a plural count literal
   <module-level code>


More information about the Python-list mailing list