2

Here's what I'm doing now:

@memoized
def reversed_matching(matching_cls):

    class ReversedMatching(ReversedSequenceMatching):

        def __init__(self, *args, **kwargs):
            super().__init__(matching_cls, *args, **kwargs)

    return ReversedMatching

I want to bind one argument of a class and return the “partial class”. I can't use functools.partial because that can't be used with isinstance and issubclass and the like. Is there a nicer way to write this?

duplode
  • 32,686
  • 7
  • 74
  • 141
Neil G
  • 30,493
  • 34
  • 149
  • 247

0 Answers0