[Python-ideas] PEP for executing a module in a package containing relative imports (original) (raw)

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