Steven D'Aprano wrote:
> On Thu, 15 Jan 2009 17:50:54 +0100, Peter Otten wrote:
>
>> 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.
>> Yo
On Thu, 15 Jan 2009 17:50:54 +0100, Peter Otten wrote:
> 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.
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(): # a plural count literal
tjr
--
http://ma
I'm not sure I fully understand the question "no moving the code to a
function", but you can prevent reload in a module by doing something
like this:
doLoad = False
try:
no_reload
except NameError:
no_reload = True
else:
raise RuntimeError, "This module is not meant to be reloaded."
--
Zach
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.
regards,
Jakub
--
http://mail.python.org/mailman/listinfo/python-list
The first line: doLoad = False, is to be ignored.
--
Zachary Burns
(407)590-4814
Aim - Zac256FL
Production Engineer (Digital Overlord)
Zindagi Games
On Thu, Jan 15, 2009 at 10:30 AM, Zac Burns wrote:
> I'm not sure I fully understand the question "no moving the code to a
> function", but you ca
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