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

Steven Bethard report at bugs.python.org
Mon Feb 7 08:58:29 CET 2011


Steven Bethard <steven.bethard at gmail.com> added the comment:

@Éric: yes, thanks!

@Anders: The reason the current implementation gives you the behavior you don't want is that the first thing it does is scan the args list for things that look like flags (based on prefix_chars). It assumes that everything that looks like a flag is intended to be one, before it ever looks at how many arguments the flag before it takes or anything like that. This is the source of your problem - argparse assumes "-safe" is a flag, and as a result, there is no argument for "--asciidoc-opts'. So perhaps a better name would be something like dont_assume_everything_that_looks_like_a_flag_is_intended_to_be_one. ;-)

----------

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


More information about the Python-bugs-list mailing list