'-m' option (was RE: [Python-Dev] ConfigParser patches)

Guido van Rossum gvanrossum at gmail.com
Mon Oct 4 17:05:01 CEST 2004

> Pros (-m over runpy.py, in order of significance as I see it):
>   - easy to combine with other Python command line options

The script approach can do this too

>   - OS & environment independent

So is the script -- probably more so, since the script can use
Python's OS independence layer.

>   - easier to use with a non-installed interpreter
>   - no work for Python packaging folks

No contest.

>   - more concise to invoke

Depends on the length of the name of the script. :-)

>   - no namespace issues with naming a script

Actually, one-letter options are a much scarcer resource than script names.

>   - C API for those embedding python

And who needs that?

> Cons:
>   - YACLO (Yet Another Command Line Option)
>   - CPython specific (other interpreters could choose to reimplement)

Additional Pros for using a script:
 - less code to maintain
 - can work with older Python versions
 - shows users how to do a similar thing themselves with additional
features (e.g. a common addition I expect will be to hardcode a
personal sys.path addition)

PS a big honking -1000 on Carlos Ribeiro's suggestion of doing this
automatically if the filename path isn't found. Too many chances for
accidentally invoking the wrong thing -- including mysyerious silences
when the named module happens to exist but doesn't do anything when
run as a script (i.e. the majority of modules). (As an aside, I wonder
why every single of Carlos' interactions starts of with an idea that
is completely misguided and then ends with him vehemently defending it
against all opposition. Sounds like a recipe for flame wars to me.)
--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list