[issue29715] Arparse improperly handles "-_"
paul j3
report at bugs.python.org
Mon Mar 13 00:11:15 EDT 2017
paul j3 added the comment:
http://bugs.python.org/issue9334, 'argparse does not accept options taking arguments beginning with dash (regression from optparse)'
is an old discussion about strings that begin with a dash and don't
match defined flags.
One proposal was to add a 'args_default_to_positional' parameter, and change the parsing that I described before to:
+ # behave more like optparse even if the argument looks like a option
+ if self.args_default_to_positional:
+ return None
# instead of return None, arg_string, None
There's a long discussion but nothing was changed (not even the test for negative numbers).
Two work arounds still apply
prog.py -- -_ # use -- to signal positional values
prog.py --first=-_ # = to attach any string to optional
(in my previous post I cited 'Bernard', I meant the module's original author, Steven Bethard. He's no longer actively involved in these bug/issues.)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29715>
_______________________________________
More information about the Python-bugs-list
mailing list