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.

Author paul.j3
Recipients arigo, bethard, paul.j3, pitrou
Date 2013-09-08.16:12:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
A possibly unintended consequence to this `seen_non_default_actions` testing is that default values do not qualify as 'present' when testing for a required mutually exclusive group.

    p.parse_args('--bar 42'.split())

raises an `error: one of the arguments --foo --bar is required`

In the original code

    p.parse_args('--foo test'.split())

does not raise an error because 'test' does not qualify as default.  But with the change I proposed, it does raise the error.

This issue may require adding a `failures_when_required` category to the MEMixin class.  Currently nothing in tests for this issue.

Note that this contrasts with the handling of ordinarily required arguments.


'--baz 42' does not raise an error.  It is 'present' regardless of whether its value matches the default or not.

This argues against tightening the `seen_non_default_actions` test.  Because the current testing only catches a few defaults (None and small ints) it is likely that no user has come across the required group issue.  There might actually be fewer compatibility issues if we simply drop the default test (or limit it to the case where the default=None).
Date User Action Args
2013-09-08 16:12:22paul.j3setrecipients: + paul.j3, arigo, pitrou, bethard
2013-09-08 16:12:22paul.j3setmessageid: <>
2013-09-08 16:12:22paul.j3linkissue18943 messages
2013-09-08 16:12:21paul.j3create