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

Steven Bethard steven.bethard at gmail.com
Sun Apr 22 22:56:09 CEST 2007


On 4/22/07, Jim Jewett <jimjjewett at gmail.com> wrote:
> 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
> path.

While that would address my concern, I wonder if adding sys to the
builtins is really any better than adding __main__ to the builtins.

STeVe
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy



More information about the Python-ideas mailing list