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

Anders Kaseorg report at bugs.python.org
Wed Jan 12 18:59:10 EST 2022


Anders Kaseorg <andersk at mit.edu> added the comment:

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

My concern is not that optparse will be taken away.  My concern is that the documentation incorrectly discourages its use.

https://docs.python.org/3/library/optparse.html
“Deprecated since version 3.2: The optparse module is deprecated and will not be developed further; development will continue with the argparse module.”

Given that the apparent conclusion of this bug is that argparse has also become too difficult to fix, either argparse should be deprecated for exactly the same reason, or optparse should be un-deprecated.

Most programs don’t need the extra features of argparse, and optparse doesn’t have this bug, so optparse is a better default choice; the documentation should not be encouraging argparse over it.

----------

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


More information about the Python-bugs-list mailing list