[issue32027] argparse allow_abbrev option also controls short flag combinations

2018-09-10 Thread paul j3


paul j3  added the comment:

The PR 4396 should be closed.

--
nosy: +paul.j3

___
Python tracker 

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



[issue32027] argparse allow_abbrev option also controls short flag combinations

2017-11-16 Thread Berker Peksag

Berker Peksag  added the comment:

Thank you for the report and for the PR. I think this is a duplicate of issue 
26967.

> This issue is either a doc issue only or an unintended combination of
> long option shortening and (the way more common) flag combinations.

This is indeed a bug so it would be better to fix it.

--
nosy: +berker.peksag
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> argparse: allow_abbrev=False stops -vv from working
type:  -> behavior
versions:  -Python 3.5, Python 3.8

___
Python tracker 

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



[issue32027] argparse allow_abbrev option also controls short flag combinations

2017-11-14 Thread Jörn Hees

Change by Jörn Hees :


--
keywords: +patch
pull_requests: +4344
stage:  -> patch review

___
Python tracker 

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



[issue32027] argparse allow_abbrev option also controls short flag combinations

2017-11-14 Thread Jörn Hees

New submission from Jörn Hees :

The allow_abbrev option (default True) currently is documented like this 
(https://docs.python.org/3/library/argparse.html#allow-abbrev):
> Normally, when you pass an argument list to the parse_args() method of an 
> ArgumentParser, it recognizes abbreviations of long options.

However, it also controls combinations of short options and especially the 
combination of flags (store_const) like `-a -b` as `-ab`.

Example snippet for testing:

import argparse
import sys

parser = argparse.ArgumentParser(
allow_abbrev=False
)
parser.add_argument('-a', action='store_true')
parser.add_argument('-b', action='store_true')
parser.add_argument('x', nargs='*')
parser.parse_args('-a -b foo bar'.split())
parser.parse_args('-ab foo bar'.split())


As you can see the 2nd parse will fail if allow_abbrev=False.

This issue is either a doc issue only or an unintended combination of long 
option shortening and (the way more common) flag combinations. When i 
deactivated this in my code, i wanted to disable the (nice to have) long option 
shortening, but i unintentionally also deactivated (MUST have) short flag 
combinations.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 306229
nosy: docs@python, joern
priority: normal
severity: normal
status: open
title: argparse allow_abbrev option also controls short flag combinations
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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