Author paul.j3
Recipients John.Didion, bethard, manveru, paul.j3, xuanji
Date 2014-02-26.07:24:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393399449.24.0.148703449699.issue11588@psf.upfronthosting.co.za>
In-reply-to
Content
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')
History
Date User Action Args
2014-02-26 07:24:09paul.j3setrecipients: + paul.j3, bethard, xuanji, John.Didion, manveru
2014-02-26 07:24:09paul.j3setmessageid: <1393399449.24.0.148703449699.issue11588@psf.upfronthosting.co.za>
2014-02-26 07:24:09paul.j3linkissue11588 messages
2014-02-26 07:24:08paul.j3create