[Python-3000] PEP to change how the main module is delineated

Brett Cannon brett at python.org
Tue Apr 24 00:08:03 CEST 2007

On 4/23/07, Guido van Rossum <guido at python.org> wrote:
> On 4/22/07, Brett Cannon <brett at python.org> wrote:
> > This PEP is to change the ``if __name__ == "__main__": ...`` idiom to
> > ``if __name__ == sys.main: ...``  so that you at least have a chance
> > to execute module in a package that use relative imports.
> >
> > Ran this PEP past python-ideas.  Stopped the discussion there when too
> > many new ideas were being proposed.  =)  I have listed all of them in
> > the Rejected Ideas section, although if overwhelming support for one
> > comes forward the PEP can shift to one of them.
> I'm -1 on this and on any other proposed twiddlings of the __main__
> machinery. The only use case seems to be running scripts that happen
> to be living inside a module's directory, which I've always seen as an
> antipattern. To make me change my mind you'd have to convince me that
> it isn't.

With Guido not liking it and people not agreeing on a solution with me
not feeling like fighting for this one I consider the PEP rejected.
When I get my laptop back (end of the week hopefully) I will check the
PEP in as rejected so that we don't have to go through this again.

Thanks to everyone to contributed to the conversation.


More information about the Python-3000 mailing list