Mads Michelsen <madch...@gmail.com> added the comment: Okay, I'll try:
Save the following code as argparse_test.py: [CODE] #! /usr/bin/env python2 import argparse def args_config(about): parser = argparse.ArgumentParser(description=about) dummy_group = parser.add_argument_group(title='mutually exclusive') test_group = dummy_group.add_mutually_exclusive_group() test_group.add_argument('-a', action='store_true', default=False, \ help='This is the r option') test_group.add_argument('-b', action='store_true', default=False, \ help='This is the b option') test_group.add_argument('-c', action='store_true', default=False, \ help='And this is the c option') args_ns = parser.parse_args() return args_ns about = 'This is a test case' args_ns = args_config(about) print args_ns [/CODE] The use the -h argument to see help output: [OUTPUT] [~] python/argparse_test.py -h usage: argparse_test.py [-h] [-a] [-b] [-c] This is a test case optional arguments: -h, --help show this help message and exit mutually exclusive: -a This is the r option -b This is the b option -c And this is the c option [/OUTPUT] The run it with all the options together to test exclusivity: [OUTPUT] [~] python/argparse_test.py -abc Namespace(a=True, b=True, c=True) [/OUTPUT] What happens: As you can see, there are no objections to using all three options at the same time. Neither does the help output indicate that there should be. What should happen: If I have understood the instructions in the Issue report on Google correctly, the assumption is that this workaround (i.e. using a dummy group) should produce the desired result (i.e. that running the command argparse_test.py -abc" should appear as and be prbohibited) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10680> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com