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 <rep...@bugs.python.org>
<http://bugs.python.org/issue29715>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to