How about some syntactic sugar for " __name__ == '__main__' "?

Ian Kelly ian.g.kelly at
Thu Nov 13 23:56:33 CET 2014

On Thu, Nov 13, 2014 at 1:53 PM, Skip Montanaro
<skip.montanaro at> wrote:
> On Thu, Nov 13, 2014 at 2:44 PM, Skip Montanaro
> <skip.montanaro at> wrote:
>> 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.

In fact it seems the behavior does differ between Python 2.7 and Python 3.4:

$ cat
import atexit

def main():

def goodbye():
$ python2
$ python3

More information about the Python-list mailing list