Message289530
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.) |
|
Date |
User |
Action |
Args |
2017-03-13 04:11:15 | paul.j3 | set | recipients:
+ paul.j3, r.david.murray, martin.panter, Max Rothman |
2017-03-13 04:11:15 | paul.j3 | set | messageid: <1489378275.92.0.436711160823.issue29715@psf.upfronthosting.co.za> |
2017-03-13 04:11:15 | paul.j3 | link | issue29715 messages |
2017-03-13 04:11:15 | paul.j3 | create | |
|