atexit.register in case of errors

Andrea Crotti andrea.crotti.0 at
Wed Feb 15 10:41:12 EST 2012

On 02/15/2012 03:18 PM, Thomas Rachel wrote:
> Wouldn't
> if __name__ == '__main__':
>     try:
>         main()
>     finally:
>         goodbye()
> be even better? Or doesn't it work well together with SystemExit?
> Thomas

Well in that case goodbye is always called, even if I have some other 
nasty exception,
which is not what I want.. (and is exactly what I had with atexit.register).
Isn't it?

More information about the Python-list mailing list