New issue 76 by iElect...@gmail.com: Handling arguments after --
http://code.google.com/p/argparse/issues/detail?id=76
optparse stopped parsing arguments after --, how can the same be achieved
with argparse?
For example:
commmand -v -- --option
I want argparse handle arguments only until --. The rest should be left
unparsed, ready to pass in subprocess
Seems like you've uncovered a bug. It does handle "--" correctly, unless
you don't have any positional arguments. Can you please file this bug on
the Python tracker (bugs.python.org)? All future work on argparse will
occur in the Python trunk, not here.
Sample code:
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('-v', action='store_true')
>>> parser.add_argument('foo')
>>> parser.parse_args(['-v', '--', '--foo'])
Namespace(foo='--foo', v=True)
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('-v', action='store_true')
>>> parser.parse_args(['--', '-f'])
usage: [-h] [-v]
: error: unrecognized arguments: -- -f
Comment #3 on issue 76 by steven.bethard: Handling arguments after --
http://code.google.com/p/argparse/issues/detail?id=76
Moved to bugs.python.org.