New submission from Sergey Konoplev gray...@gmail.com:
Hello,
I am starting to use argparse package and faced the problem where an optional
argument w/ nargs='+' conflicts w/ a positional argument.
Here is the test case:
import argparse
p = argparse.ArgumentParser()
p.add_argument('foo',
Éric Araujo mer...@netwok.org added the comment:
Thanks for the bug report. Can you try separating option arguments from
positional arguments with “--”? If yes, this would be a doc bug.
Also, can you reproduce it with Python 2.7?
--
nosy: +merwok
Eric Smith e...@trueblade.com added the comment:
I get the same behavior in 2.7. Adding '--', I get:
p.parse_args('-b 123 456 -- bla'.split())
Namespace(bar=[123, 456], foo='bla')
Which is what I expect.
Éric: From your comment, I'm not sure if you think it's a doc bug because '--'
does
Éric Araujo mer...@netwok.org added the comment:
I was suggesting a doc bug only if the current doc didn’t advertise clearly
this way of combining nargs with positional arguments. Using “--” is most
certainly standard and right,
Using “--” to explicitly signal positional arguments is most
Éric Araujo mer...@netwok.org added the comment:
Duh, please ignore the first two lines, I forgot to remove them after
rephrasing my comment. Sorry.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9182
Fred L. Drake, Jr. fdr...@acm.org added the comment:
On Tue, Jul 6, 2010 at 4:33 PM, Éric Araujo rep...@bugs.python.org wrote:
Using “--” to explicitly signal positional arguments is most certainly
right and standard, but people have to read about that for the first
time somewhere. In a