paul j3 added the comment:

The addition of a simple decorator to the 'ArgumentParser' class, would 
simplify registering the tests:

    def crosstest(self, func):
        # decorator to facilitate adding these functions
        name = func.__name__
        self.register('cross_tests', name, func)

which would be used as:

    @parser.crosstest
    def pat_or_suf(parser, seen_actions, *args):
        if 2==len(seen_actions.intersection([a_pat, a_suf])):
            parser.error('only one of PATTERN and SUFFIX allowed')

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11588>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to