[Python-Dev] Distutils2 scripts

Gisle Aas gisle at activestate.com
Sat Oct 9 09:02:24 CEST 2010


On Oct 9, 2010, at 1:07 , James Y Knight wrote:

> On Oct 8, 2010, at 5:24 PM, Gisle Aas wrote:
> 
>> On Oct 8, 2010, at 9:22 , Jeroen Ruigrok van der Werven wrote:
>> 
>>> +1 from me. I sincerely dislike the Perl-esque -m stuff.
>> 
>> As a Perl/Python guy I have to object to calling the -m stuff Perl-esque.  This is a very Pythonish thing.  In the Perl world we never treat modules as scripts; they are separate concepts written separately and installed in separate locations.  There is no feature of perl similar to the Pythonish -m stuff.
> 
> 
> Yes there is. -m and -M.
> 
> E.g., the widely advertised perl -MCPAN -e install. It's not identical to python's -m, to be sure, but it's *similar*.

It might look similar but it's not.

If it was similar 'python -mfoo' would be a shortcut for 'python -c "import foo"' and 'python -Mfoo' would be a shortcut for 'python -c "from foo import *".  It would also have to be possible to repeat the -c option.  Then we could have written the Perl-esque:

    python -Mdistutils2.depgraph -c "main()"

There is no way to do something similar to 'python -mfoo ...' from perl.  The closest thing I could think of would be 'perl $(perldoc -l foo) ...', assuming a bash-like shell.

Regards,
Gisle



More information about the Python-Dev mailing list