Dag Sverre Seljebotn, 09.08.2011 08:51:
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.

Agreed. I never understood why the CPython devs decided to deprecate optparse in 2.7.


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.

Since Stefano has decided to write the code, I think the "it's there and it works" argument is basically dead already. And I do see the advantage of using the "standard" tool for the job.

However, I also see the problem that optparse is deprecated and may get removed in a future 3.x version. So, switching to optparse now means that we may have to switch to something else later, whereas that's not the case with the current code, however clumsy and low-level it may be.

From a look at Stefano's code, it seems that it's not all that hard to support both argparse and optparse. If we can keep that up, that would solve the future upgrade problem.

I actually think that the new implementation looks much clearer than what we currently have:

https://github.com/satufk/cython/blob/13309377dd3fd90761e97718fc3297efe1e962dc/Cython/Compiler/CmdLine.py


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).

Yes, the list of "-X" options in the cmd line help text should be automatically generated from the Options. And, yes, the current status of the help text suggests that it does represent a notable maintenance overhead to keep it up to date with the implementation.

Stefan
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to