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

Steven Bethard steven.bethard at gmail.com
Sat Apr 21 20:12:57 CEST 2007


On 4/21/07, Christian Heimes <lists at cheimes.de> wrote:
> If you like to introduce __main__ why not implement
> http://www.python.org/dev/peps/pep-0299 ? It proposes a __main__(*argv*)
> module level function that replaced the "if __name__ == '__main__'"
> idiom. The __main__ function follows the example of other programming
> languages like C, C# and Java.

I don't like the __main__ function signature. There are lots of
options, like optparse and argparse_ that are much better than
manually parsing sys.argv as the PEP 299 signature would suggest. And
if there's nothing to be passed to the function, why make it a
function at all? Personally, I thought one of the pluses of the
current status quo (as well as what Brett is proposing here) is that
it *didn't* follow in the (misplaced IMHO) footsteps of languages like
C and Java. I think we're probably best letting dead PEPs lie.

.. _argparse: http://argparse.python-hosting.com/

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