[Python-ideas] Replacing the if __name__ == "__main__" idiom (was Re: making a module callable)

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Nov 24 23:27:35 CET 2013


Guido van Rossum wrote:
> Haven't followed all of this, but perhaps the simplest thing would be to 
> define a new builtin function that returns True in the namespace of the 
> main module and false everywhere else.

Can someone remind me why there's so much resistance to
simply blessing a __main__() function? It would be
straightforward and intuitive and in line with what
just about every other language does.

-- 
Greg


More information about the Python-ideas mailing list