imported method from module evaluates to None in some cases
Paul McGuire
ptmcg at austin.rr.com
Sun Nov 23 05:58:24 EST 2008
On Nov 23, 4:21 am, Hrvoje Niksic <hnik... at xemacs.org> wrote:
>
> I don't know why the interpreter would shut down abruptly, but I
> suppose you could inspect the traceback to see what exactly caused the
> exception?- Hide quoted text -
>
While you puzzle out the root cause, could something like this help
alleviate your race condition at interpreter shutdown?
-- Paul
def safe_call(fn, alt):
if fn is not None:
return fn
return alt
def WakeupAlt():
print "Wakeup has been set to None"
def Wakeup():
print "This is your wakeup call..."
safe_call(Wakeup,WakeupAlt)()
Wakeup = None
safe_call(Wakeup,WakeupAlt)()
prints:
This is your wakeup call...
Wakeup has been set to None
More information about the Python-list
mailing list