classification
Title: argparse should have an option to require un-abbreviated option names
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: argparse: disable abbreviation
View: 14910
Assigned To: Nosy List: Michael.Edwards, bethard, chris.jerdonek, r.david.murray
Priority: low Keywords: easy

Created on 2012-12-05 13:28 by Michael.Edwards, last changed 2012-12-08 05:32 by terry.reedy. This issue is now closed.

Files
File name Uploaded Description Edit
test.py Michael.Edwards, 2012-12-05 13:28
Messages (4)
msg176981 - (view) Author: Michael Edwards (Michael.Edwards) Date: 2012-12-05 13:28
When running parse_args, ArgumentParser is liberal in accepting parameters. Partial matches will be accepted as arguments

(in the included example, --test bob, --tester bob, --testers bob all set the testers argument)

Perhaps this is documented, but it was super unexpected for me.
msg176986 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-12-05 13:48
It is both documented (http://docs.python.org/dev/library/argparse.html#argument-abbreviations) and an important feature.

I thought there was an enhancement request in this tracker for making the behavior optional, but I couldn't find it when I looked, so I'm turning this into one.  If someone finds that there is already another issue this one can be closed as a dup.

I'm marking it low priority, though, because I think most people want the ability to abbreviate the option names.
msg176995 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-12-05 17:49
David, is issue 14910 the one you were thinking of?
msg176997 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-12-05 18:45
It is indeed.  And it even has a patch.  Don't know how I missed it.
History
Date User Action Args
2012-12-08 05:32:22terry.reedysetstatus: open -> closed
2012-12-05 18:45:51r.david.murraysetsuperseder: argparse: disable abbreviation
resolution: duplicate
messages: + msg176997
stage: needs patch -> resolved
2012-12-05 17:49:49chris.jerdoneksetnosy: + chris.jerdonek
messages: + msg176995
2012-12-05 13:48:48r.david.murraysetpriority: normal -> low

type: enhancement

versions: + Python 3.4, - Python 2.7
keywords: + easy
nosy: + bethard, r.david.murray
title: argparse accepts partial parameters -> argparse should have an option to require un-abbreviated option names
messages: + msg176986
stage: needs patch
2012-12-05 13:28:07Michael.Edwardscreate