[Python-ideas] Just __main__

Stephen J. Turnbull stephen at xemacs.org
Mon Jun 18 18:57:15 CEST 2012

Ethan Furman writes:
 > anatoly techtonik wrote:
 > > How about global __main__ as a boolean?


Saves typing, yes, but otherwise there's no point.  It would need just
as much explanation, for one thing.

 > you would have:
 >    if __main__:
 >      ...

Would it be writable?

__main__ = False

if __main__:
    print("Oh, I didn't want to run these tests anyway...")

More information about the Python-ideas mailing list