[issue9334] argparse does not accept options taking arguments beginning with dash (regression from optparse)
Anders Kaseorg
report at bugs.python.org
Sat Mar 26 19:11:02 CET 2011
Anders Kaseorg <andersk at mit.edu> added the comment:
> @andersk: Would the restriction to only having flags with a fixed
> number of arguments be acceptable for your use case?
I think that’s fine. Anyone coming from optparse won’t need options with optional arguments.
However, FWIW, GNU getopt_long() supports options with an optional argument under the restrictions that:
• the option must be a long option,
• the optional argument must be the only argument for the option, and
• the argument, if present, must be supplied using the
‘--option=argument’ form, not the ‘--option argument’ form.
This avoids all parsing ambiguity. It would be useful to have feature parity with getopt_long(), to facilitate writing Python wrapper scripts for C programs.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9334>
_______________________________________
More information about the Python-bugs-list
mailing list