[issue10680] argparse: titles and add_mutually_exclusive_group don't mix (even with workaround)

Mads Michelsen report at bugs.python.org
Sat Dec 11 17:00:49 CET 2010


New submission from Mads Michelsen <madchine at gmail.com>:

This is a follow-up to Issue 58 from the Google Project Hosting bug tracker (http://code.google.com/p/argparse/issues/detail?id=58). I couldn't find any equivalent/re-posting of it here, so I took the liberty of creating a new one - despite the bug being marked 'WontFix' on Google. The reason for this is that I cannot make the suggested workaround... well, work. 

The root problem: the argparse parser add_mutually_exclusive_group method does not accept title or description arguments. 

The workaround: steven.bethard suggests on google to create a 'straight' dummy group (i.e. one made using the title-accepting add_argument_group method) and then attach the mutually exclusive group to the dummy group - which is attached to the parser itself. 

The problem: while the group does appear as a group with title on the help output, the group does not appear to actually _be_ mutually exclusive (I get no objections to running several arguments from the same group together) nor does it display as mutually exclsuive on the help output. 

Please see attached file for code + resulting output.

(I hope I'm doing this right - this is my first bug report, so bear with and instruct me if I'm getting it wrong)

----------
components: Library (Lib)
files: argsconfig.txt
messages: 123797
nosy: Mads.Michelsen
priority: normal
severity: normal
status: open
title: argparse: titles and add_mutually_exclusive_group don't mix (even with workaround)
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file20014/argsconfig.txt

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10680>
_______________________________________


More information about the Python-bugs-list mailing list