title: How can a python base class tell whether a sub class has overridden its methods?
body: <p>Here is my guess, which doesn't work:</p>
  
  <pre><code>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()
  </code></pre>
  
  <p>Ideally, methods_implemented() would return ['foo'].</p>
  
  <p>How?</p>
  
  <p>(Why would I want to do this?  My base class is an HTTP Resource class which has methods GET, POST etc. By default they return 405 Method Not Implemented. It also has a method OPTIONS which should return a 200 response with the header Allow set to the methods which any subclass implements.)</p>