I have a method called render that is actually implemented by a subclass and called like this:

class MyClass(object): def __call__(self, *args, **kwargs): api_response = self.render(*args, **kwargs) return api_response def render(self, *args, **kwargs): """ This method is implemented by a subclass.""" raise NotImplementedError def cascade_callables(): print 'Ask awesome people at stackoverflow for the solution to this problem.'

I have a list of callables [c1, c2, c3] . I want to do something like this inside the cascade_callables method which should be something like this:

def cascade_callables(): callables = [c1, c2, c3] callables.append(self.render) self.render = reduce(some_decorator_that_accepts_two_functions, callables)

So essentially, I am trying my render to work like this without modifying the actual implementation:

c1(*args, **kwargs) c2(*args, **kwargs) c3(*args, **kwargs) render(*args, **kwargs)

I tried something like this to work as the decorator for me that I can use in reduce :

def cascade_modifiers(modifier1, modifier2): def cascaded_modifier(self, *args, **kwargs): modifier1(self, *args, **kwargs) modifier2(self, *args, **kwargs) return cascaded_modifier

But I got this:

TypeError: cascaded_modifier() takes at least 1 argument (0 given)

What is the best approach to solve this problem in Python 2.7 using the paradigm that I have tried explaining in this question?