[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args
Roundup Robot added the comment: New changeset c457bd1935f9 by Eli Bendersky in branch '3.3': Issue #19814: Clarify argparse's docs w.r.t prefix matching http://hg.python.org/cpython/rev/c457bd1935f9 New changeset 46976bd44bfc by Eli Bendersky in branch 'default': Issue #19814: Clarify argparse's docs w.r.t prefix matching http://hg.python.org/cpython/rev/46976bd44bfc -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19814 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args
Roundup Robot added the comment: New changeset 181ced5bf0be by Eli Bendersky in branch '2.7': Issue #19814: Clarify argparse's docs w.r.t prefix matching http://hg.python.org/cpython/rev/181ced5bf0be -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19814 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args
Changes by Eli Bendersky eli...@gmail.com: -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19814 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args
paul j3 added the comment: `parse_args` just calls `parse_known_args`, and then raises an error if `rest` is not empty. So it is `parse_known_args` that is doing the abbreviation matching. Abbreviation matching is done relatively early, when `_parse_known_args` first loops through the strings, trying to decide which are arguments ('A') and which are options ('O'). This matching is done in `_parse_optional`. It's not something it does at the end on the 'leftovers'. http://bugs.python.org/issue14910, a disable abbreviation option, might be a better solution. Your example is an argument in favor of implementing that feature. Unless a reader has your example in mind, the proposed documentation warning might be more confusing than helpful. -- nosy: +paul.j3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19814 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args
Eli Bendersky added the comment: I don't see how these implementation details are relevant. The patch adds a link to the existing abbreviations section, which mentions parse_args - so it's clear that this behavior exists in both. Yes, #14910 (to which I pointed in the original message in this issue) is the long term solution, but it's only for Python 3.5; until then, as the mailing discussion has demonstrated, the documentation is unclear on this matter and needs clarification. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19814 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args
Eli Bendersky added the comment: If I don't see any further objections I'll go ahead and commit this by the end of the week -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19814 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args
New submission from Eli Bendersky: Prefix matching behavior can lead to bugs when combined with parse_known_args. See this thread for more details: https://mail.python.org/pipermail/python-dev/2013-November/130601.html Issue #14910 deals with making it optional, but until 3.5 we'll have to do with a documentation warning. -- assignee: eli.bendersky components: Documentation messages: 204584 nosy: bethard, eli.bendersky, r.david.murray priority: high severity: normal status: open title: Document prefix matching behavior of argparse, particularly for parse_known_args versions: Python 2.7, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19814 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args
Eli Bendersky added the comment: Here's a patch for 3.3; if it looks ok i'll merge it to default and also to 2.7 -- keywords: +patch Added file: http://bugs.python.org/file32870/issue19814.doc33.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19814 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com