Author paul.j3
Recipients John.Didion, bethard, cjmayo, manveru, paul.j3, xuanji
Date 2016-05-16.21:52:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1463435551.62.0.36360526364.issue11588@psf.upfronthosting.co.za>
In-reply-to
Content
So far I've proposed adding a 'hook' at the end of '_parse_known_args', that would give the user access to the 'seen_non_default_actions' variable.  This function could perform an almost arbitrarily complex set of logical co-occurrence tests on this set (or list) of Actions.

The rest of my proposed patches (nested groups, etc) are user interface components that attempt make this testing more user-friendly, both in specification and usage display.

It just occurred to me that an alternate stop-gap fix is to make 'seen_non_default_actions' available to the user for his own testing after parsing.  Adding it to the method return is not backward compatible.  But it could be added as an attribute to parser.

     self._seen_actions = seen_non_default_actions

It would be the first case of giving the parser a memory of past parsing actions, but I don't think that's a problem.

Another possibility is to conditionally add it to the 'namespace'. 

     if hasattr(namespace, 'seen_actions'):
        setattr(namespace, 'seen_actions', seen_non_default_actions)

The user could initial this attribute with a custom 'Namespace' object or with a 'set_defaults' call.

(I'm  proposing to save 'seen_non_default_actions' because in my earlier tests that seemed to be more useful than 'seen_actions'.  It's the one used by mutually_exclusive_group testing.)
History
Date User Action Args
2016-05-16 21:52:31paul.j3setrecipients: + paul.j3, bethard, cjmayo, xuanji, John.Didion, manveru
2016-05-16 21:52:31paul.j3setmessageid: <1463435551.62.0.36360526364.issue11588@psf.upfronthosting.co.za>
2016-05-16 21:52:31paul.j3linkissue11588 messages
2016-05-16 21:52:31paul.j3create