On Thu, Nov 13, 2014 at 10:19 AM, Terry Reedy <tjre...@udel.edu> wrote: > Functions have an implicit 'return None' at the end (which, in CPython, > become an explicit pair of bytecodes, even when the function already ends > with return something'. The simplest proposal is that modules have an > implicit "if __name__ == '__main__': main()" at the end. I think this would > not have to be added to the bytecode. > > This magical invocation mimics C and some other languages, and I think it > works well.
Yes, but it conflicts with the existing and common usage of having that explicitly in the code. Safer - and more in line with the way other such functions are written - would be a dunder function: if __name__ == '__main__': __main__() ChrisA -- https://mail.python.org/mailman/listinfo/python-list