You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
argparse allow_abbrev option also controls short flag combinations #76208
3.7 (EOL)end of lifedocsDocumentation in the Doc dirstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
bpo-26967: argparse: allow_abbrev=False stops -vv from working
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2017-11-16.08:01:13.956>created_at=<Date2017-11-14.17:29:42.336>labels= ['3.7', 'type-bug', 'library', 'docs']
title='argparse allow_abbrev option also controls short flag combinations'updated_at=<Date2018-09-11.01:47:50.345>user='https://github.com/joernhees'
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.
3.7 (EOL)end of lifedocsDocumentation in the Doc dirstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
Activity
joernhees commentedon Nov 14, 2017
The allow_abbrev option (default True) currently is documented like this (https://docs.python.org/3/library/argparse.html#allow-abbrev):
However, it also controls combinations of short options and especially the combination of flags (store_const) like
-a -bas-ab.Example snippet for testing:
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.
berkerpeksag commentedon Nov 16, 2017
Thank you for the report and for the PR. I think this is a duplicate of bpo-26967.
This is indeed a bug so it would be better to fix it.
paulj3 commentedon Sep 11, 2018
The PR 4396 should be closed.