[issue9334] argparse does not accept options taking arguments beginning with dash (regression from optparse)

Raymond Hettinger report at bugs.python.org
Mon Dec 27 01:39:09 EST 2021


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

> we should undo the deprecation of optparse in the documentation 
> (https://bugs.python.org/issue37103), since the stated justification 
> for that deprecation was that optparse will not be developed further.

While optparse that it isn't being developed further, therebut will not be taken away.  IIRC the reason for this was that it too had become difficult to build out and that is what necessitated the creation of argparse -- there wasn't clean way to add the desired features (subparsers, actions, etc).


> If it's going to be closed, it should at least be acknowledged 
> that it *is* a fundamental design flaw

That seems a spiteful demand. It is more correct to say that the design met its original intended goals but unfortunately the structure of the first pass scan precludes cleanly handling arguments with dashes.  The limitations are noted in the docs in the section, "Arguments containing -". 

As Eric pointed out, there are alternative argument parsing packages available on PyPI.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue9334>
_______________________________________


More information about the Python-bugs-list mailing list