I want to apply the same decorator to every method in a given class, other than those that start and end with __.
__
It seems to me it should be doable using
You could do this (not sure if this is the most elegant way though):
def get_all_instance_methods(x): return filter(callable, map(lambda d: getattr(x, d), dir(x)))
As for the cls.method_name, you will have to use getattr(cls, method_name).
cls.method_name
getattr(cls, method_name)