[issue37227] Wrong parse long argument

2019-06-12 Thread paul j3


Change by paul j3 :


--
nosy: +paul.j3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37227] Wrong parse long argument

2019-06-11 Thread Eric V. Smith


Eric V. Smith  added the comment:

Although note that with allow_abbrev=False, -l will conflict with --long, which 
I'm not sure is a great design.

I'm closing this as not a bug, since it works as documented and there's a 
workaround (albeit not in 2.7, which is closed to new features).

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37227] Wrong parse long argument

2019-06-11 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

argparse allows abbreviations by default so --li matches --list as a prefix 
match. This is documented at 
https://docs.python.org/2.7/library/argparse.html#argument-abbreviations-prefix-matching

>From python 3.5 allow_abbrev=False can be passed to ArgumentParser to disable 
>this. See also issue10981 and issue14910 that implemented this. 
>https://docs.python.org/3/library/argparse.html#argument-abbreviations-prefix-matching.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37227] Wrong parse long argument

2019-06-11 Thread chr0139


chr0139  added the comment:

I think --li is not the same argument as --list

So I expect that

parser.parse_args(['-l']) or parser.parse_args(['--list'])

should be only two options which should leads to the result

Namespace(list=True, upgrade=False)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37227] Wrong parse long argument

2019-06-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37227] Wrong parse long argument

2019-06-11 Thread Eric V. Smith


Eric V. Smith  added the comment:

And what is your expected result, and why?

--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37227] Wrong parse long argument

2019-06-11 Thread chr0139


New submission from chr0139 :

I have this script

import argparse
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
group.add_argument('-l', '--list', action='store_true', help="show help")
group.add_argument('-u', '--upgrade', action='store_true', help="show help")
parser.parse_args(['--li'])

and this is the unexpected result:

Namespace(list=True, upgrade=False)

--
components: Library (Lib)
messages: 345203
nosy: chr0139
priority: normal
severity: normal
status: open
title: Wrong parse long argument
type: behavior
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com