How about some syntactic sugar for " __name__ == '__main__' "?
ian.g.kelly at gmail.com
Thu Nov 13 23:48:52 CET 2014
On Thu, Nov 13, 2014 at 1:44 PM, Skip Montanaro
<skip.montanaro at gmail.com> wrote:
> On Thu, Nov 13, 2014 at 2:33 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
>> ... other things decorated with atexit.register
>> might actually be called before the main function
> I don't think that will happen. The atexit module is documented to
> execute its exit functions in reverse order.
Right, so if something else gets registered after the main function,
it will be called before the main function.
> What's not documented is
> the behavior of calling atexit.register() while atexit._run_exitfuncs
> is running. That's an implementation detail, and though unlikely to
> change, it might be worthwhile getting that behavior documented.
Since the exit functions are executed in reverse order, anything
registered at this time would have to be called before something else
that has already been called, so I would expect this to be an error
More information about the Python-list