Here is my hunch that doesn't work:
class BaseClass(object): def foo(self): return 'foo' def bar(self): return 'bar' def methods_implemented(self): """This doesn't work...""" overriden = [] for method in ('foo', 'bar'): this_method = getattr(self, method) base_method = getattr(BaseClass, method) if this_method is not base_method: overriden.append(method) return overriden class SubClass(BaseClass): def foo(self): return 'override foo' o = SubClass() o.methods_implemented()
Ideally, method_implemented () will return ['foo'].
How?
(Why do I want to do this? My base class is an HTTP resource class that has GET, POST methods, etc. By default they return 405 Method Not Implemented. It also has an OPTIONS method that should return a 200 s response heading Allow a set of methods that any subclass implements.)
python
Tenac
source share