[issue9077] argparse does not handle arguments correctly after --

Georg Brandl report at bugs.python.org
Tue Jun 29 09:12:54 CEST 2010


Georg Brandl <georg at python.org> added the comment:

No, this is not intentional.  Look at the docs for these attributes:

parser.largs
    the current list of leftover arguments, ie. arguments that have been consumed but are neither options nor option arguments. Feel free to modify parser.largs, e.g. by adding more arguments to it. (This list will become args, the second return value of parse_args().)
parser.rargs
    the current list of remaining arguments, ie. with opt_str and value (if applicable) removed, and only the arguments following them still there. Feel free to modify parser.rargs, e.g. by consuming more arguments.


In short, they are used *while* parsing options, and have no meaning afterwards; that the OptionParser stops moving items from rargs to largs after the "--" is an implementation detail.

----------

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


More information about the Python-bugs-list mailing list