[issue16970] argparse: bad nargs value raises misleading message

2013-01-18 Thread Robert Leenders

Changes by Robert Leenders :


Added file: http://bugs.python.org/file28767/argparse-v2.patch

___
Python tracker 
<http://bugs.python.org/issue16970>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16970] argparse: bad nargs value raises misleading message

2013-01-18 Thread Robert Leenders

Changes by Robert Leenders :


Removed file: http://bugs.python.org/file28766/argparse-v2.patch

___
Python tracker 
<http://bugs.python.org/issue16970>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16970] argparse: bad nargs value raises misleading message

2013-01-18 Thread Robert Leenders

Robert Leenders added the comment:

Chris, you said (in the review) "Hmm, since this is for maintenance releases 
... This change could cause "working" code to no longer work."

I understood from our original message that you wanted it to change since it is 
inconsistent. I vote for changing it (so that it gives an error) but since this 
is my first bug/patch, I don't really know what usually happens.

Either way, I adjusted the patch conform your comments. For now I removed the 
original changes to handle negative numbers and changed the message from "nargs 
must be > 0" to "nargs must be != 0".

--
Added file: http://bugs.python.org/file28766/argparse-v2.patch

___
Python tracker 
<http://bugs.python.org/issue16970>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16970] argparse: bad nargs value raises misleading message

2013-01-17 Thread Robert Leenders

Robert Leenders added the comment:

The new issue about PARSER can be found here: http://bugs.python.org/issue16988

--

___
Python tracker 
<http://bugs.python.org/issue16970>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16988] argparse: PARSER option for nargs not documented

2013-01-17 Thread Robert Leenders

New submission from Robert Leenders:

There is a value for nargs: PARSER="A..." which is not documented at 
http://docs.python.org/3.4/library/argparse.html#nargs. The docstring for the 
action class in argparse.py also does not list PARSER as a valid value for 
nargs.

In argparse.py on line 2199-2201 it says:
# Allow one argument followed by any number of options or arguments
elif nargs == PARSER:
nargs_pattern = '(-*A[-AO]*)'

This is the only hint that I could find on what it is about.

--
assignee: docs@python
components: Documentation
messages: 180155
nosy: ReDAeR, bethard, docs@python
priority: normal
severity: normal
status: open
title: argparse: PARSER option for nargs not documented
type: enhancement
versions: Python 3.4

___
Python tracker 
<http://bugs.python.org/issue16988>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16970] argparse: bad nargs value raises misleading message

2013-01-17 Thread Robert Leenders

Robert Leenders added the comment:

Attached is a patch which solves these problems and adds test cases of Chris 
Jerdonek. When nargs is negative the same ValueError is raised as when nargs is 
zero. Also when nargs is any other invalid value a ValueError("invalid value 
for nargs") is raised.

I have one question and that is about the value PARSER="A..." for nargs, it's a 
valid option and there are test cases with nargs="A...", however it is not 
listed in the documentation: 
http://docs.python.org/dev/library/argparse.html#nargs

--
keywords: +patch
nosy: +ReDAeR
Added file: http://bugs.python.org/file28759/argparse.patch

___
Python tracker 
<http://bugs.python.org/issue16970>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com