This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: argparse's add_mutually_exclusive_group() should accept title and description
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: support title and description in argparse add_mutually_exclusive_group
View: 17218
Assigned To: Nosy List: barry, berker.peksag
Priority: normal Keywords:

Created on 2016-09-20 20:59 by barry, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg277067 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2016-09-20 20:59
I'd love to sneak this into 3.6, but I can accept being too late.  In any case, _MutuallyExclusiveGroup.__init__() should accept title and description arguments and pass them to the super class.  Otherwise, you can't great a mutually exclusive group that also essentially acts as an argument group.
msg277069 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2016-09-20 21:04
Hmm, it might be more complicated than that, so let's ignore 3.6
msg277071 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2016-09-20 21:09
The workaround is to do something like:

group = parser.add_argument_group(title, description)
me_group = group.add_mutually_exclusive_group()
me_group.add_argument(...blah blah blah...)
msg277079 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-09-20 23:00
Unless I'm missing something, this is a duplicate of issue 17218 :)
History
Date User Action Args
2022-04-11 14:58:37adminsetgithub: 72407
2016-09-20 23:00:15berker.peksagsetstatus: open -> closed

superseder: support title and description in argparse add_mutually_exclusive_group

nosy: + berker.peksag
messages: + msg277079
resolution: duplicate
stage: resolved
2016-09-20 21:09:09barrysetmessages: + msg277071
2016-09-20 21:04:25barrysetmessages: + msg277069
versions: - Python 3.6
2016-09-20 20:59:58barrycreate