[Python-Dev] Re: atexit missing an unregister method
"Martin v. Löwis"
martin at v.loewis.de
Tue Apr 26 23:29:01 CEST 2005
Nick Jacobson wrote:
> You're right. try/finally takes care of my sample scenario. There may
> still be a case to be made for atexit.unregister(), though.
No. Anybody in need of such a feature can easily unregister it.
allregistrations=[]
def _run():
for fn in allregistrations:
fn()
atexit.register(_run)
def register(fn):
allregistrations.append(fn)
def unregister(fn):
allregistrations.remove(fn)
Regards,
Martin
More information about the Python-Dev
mailing list