[Python-ideas] PEP for executing a module in a package containing relative imports
steven.bethard at gmail.com
Sun Apr 22 07:10:16 CEST 2007
On 4/21/07, Brett Cannon <brett at python.org> wrote:
> On 4/21/07, Josiah Carlson <jcarlson at uci.edu> wrote:
> > After reading other posts in the thread, I'm going to put my support
> > into the sys.main variant. It has all of the benefits of the builtin __name__
> > == __main__, with none of the drawbacks (no builtin!), and only a slight
> > annoyance of 'import sys', which is more or less free.
> Yeah, I am starting to like it as well. Steven and Jim, what do you think?
Note that the one benefit the sys.main-only variant doesn't have is
the lower cognitive load of just having to know about __main__,
instead of having to know about __name__, import and sys.main.
That said, since the PEP as it stands introduces a sys.main anyway, we
might as well start with that. People can then play around with it
and see if we need to introduce a __main__ module attribute or builtin
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