[Cython] CmdLine.py refactoring

Dag Sverre Seljebotn d.s.seljebotn at astro.uio.no
Tue Aug 9 08:51:52 CEST 2011

On 08/09/2011 08:33 AM, Stefan Behnel wrote:
> Stefano, 08.08.2011 22:36:
>> As a proof of its quality, Fedora, Ubuntu and SuSe all ship a
>> python-argparse
>> package for older versions of python (<2.7). Given that the module is
>> self-
>> contained and as small as 80KB, wouldn't be feasible to add it as a build
>> dependency?
> Note that that's huge compared to the current command line parser. The
> current implementation doesn't even use 8K, and it's perfectly
> self-contained as well.

I'd prefer if optparse was sufficient. The main advantage of argparse to 
me seems to be in parsing command structures, such as "hg add ...", "hg 
init ...". Since we don't do that in Cython I'd think optparse would be 
sufficient, and that we should not ship argparse.

> Could you try to explain what the advantages of your new implementation
> are?

Assuming one switches to optparse, I find this line of reasoning highly 
dubious... and think the burden should be the other way: Please argue 
why custom, specific, low-level code is necesarry in Cython's command 
line parser.

Using optparse/argparse have the obvious benefits that they are higher 
level and so more stuff can be automated. In particular, better 
automatically up-to-date command line help tracking changes elsewhere in 
the codebase (such as directives that can be passed to -X).

Dag Sverre

More information about the cython-devel mailing list