How do I call super in a method decorator in Python 3? [duplicate]
问题 This question already has an answer here : Given a method, how do I return the class it belongs to in Python 3.3 onward? (1 answer) Closed 5 years ago . How do I fill in the ??? ? def ensure_finished(iterator): try: next(iterator) except StopIteration: return else: raise RuntimeError def derived_generator(method): def new_method(self, *args, **kwargs): x = method(self, *args, **kwargs) y = getattr(super(???, self), method.__name__)\ (*args, **kwargs) for a, b in zip(x, y): assert a is None