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
  • 33,731
  • 7
  • 79
  • 150
Neil G
  • 32,138
  • 39
  • 156
  • 257

0 Answers0