Issue 90 in argparse: .add_mutually_exclusive_group() only works when child of parser but not when a child of argument group

1 view
Skip to first unread message

argp...@googlecode.com

unread,
Mar 10, 2014, 5:09:59 PM3/10/14
to argpar...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 90 by dwa...@translate.org.za: .add_mutually_exclusive_group()
only works when child of parser but not when a child of argument group
http://code.google.com/p/argparse/issues/detail?id=90

What steps will reproduce the problem?

parser = argparse.ArgumentParser()
group = parser.add_argument_group("Mutually exclusive group")
megroup = group.add_mutually_exclusive_group()

# megroup.add_argument() won't create mutually exlusive option.

megroup2 = parser.add_mutually_exclusive_group()

# Works as expected


What is the expected output? What do you see instead?

You should be able to create a mutually exclusive group as a child of an
argument group.


What version of the product are you using? On what operating system?
argpase 1.2.1

Please provide any additional information below.

Tested on Python 2.7 where this works correctly. The exact same code on
Python 2.6 with argparse 1.2.1 won't enforce mutual exclusion.

Attachments:
meg.py 346 bytes

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages