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

Anders Kaseorg report at bugs.python.org
Mon Feb 7 03:08:37 CET 2011


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

> (1) It's only deprecated in the documentation

Which is why I suggested un-deprecating it in the documentation.  (I want to avoid encouraging programmers to switch away from optparse until this bug is fixed.)

> # proposed behavior
> parser = ArgumentParser(error_on_unknown_options=False)

Perhaps you weren’t literally proposing “error_on_unknown_options=False” as the name of the new flag, but note that neither the current nor proposed behaviors have nothing to do with whether arguments look like known or unknown options.  Under the proposed behavior, anything in argument position (--asciidoc-opts ___) is parsed as an argument, no matter what it looks like.

So a more accurate name might be “refuse_dashed_args=False”, or more generally (in case prefix_chars != '-'), “refuse_prefixed_args=False”?

----------

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


More information about the Python-bugs-list mailing list