This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skip.montanaro
Recipients docs@python, skip.montanaro
Date 2014-11-13.20:52:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1415911957.21.0.792604038872.issue22867@psf.upfronthosting.co.za>
In-reply-to
Content
A discussion on comp.lang.python about prettying up the "if __name__ == 'main__'" idiom led to a suggestion that a decorator could simple register the main function using atexit.register. That looks like it will work, but leaves open the possibility that while main() is running via atexit._run_exitfuncs, other exit functions might be registered.

As currently defined (at least in the Python version with 2.7), I think everything will work fine. Still, the behavior of adding new exit functions during exit is not defined. Would be kind of nice if this behavior was blessed, and then mentioned in the documentation.
History
Date User Action Args
2014-11-13 20:52:37skip.montanarosetrecipients: + skip.montanaro, docs@python
2014-11-13 20:52:37skip.montanarosetmessageid: <1415911957.21.0.792604038872.issue22867@psf.upfronthosting.co.za>
2014-11-13 20:52:37skip.montanarolinkissue22867 messages
2014-11-13 20:52:36skip.montanarocreate