[Python-ideas] PEP for executing a module in a package containing relative imports

Jim Jewett jimjjewett at gmail.com
Sun Apr 22 21:26:43 CEST 2007

On 4/22/07, Steven Bethard <steven.bethard at gmail.com> wrote:
> On 4/22/07, Christian Heimes <lists at cheimes.de> wrote:

> > I'm proposing the following changes:

> > * sys.main is added which contains the dotted name of the main
> >    script.   This allows code like:

> >      if __name__ == sys.main:

> Note that this really requires the code::

>     import sys
>     if __name__ == sys.main:

As long as we're in python-ideas, I'll throw out the radical
suggestion of auto-importing sys into builtins, the way os autoimports


More information about the Python-ideas mailing list