title: How to check if a function exist (but not inherited) in python?
body: <p>Kind of related to this question:</p>
  
  <p><a href="https://stackoverflow.com/questions/8708525/how-to-check-if-mako-function-exist">https://stackoverflow.com/questions/8708525/how-to-check-if-mako-function-exist</a></p>
  
  <p>I want to check if a function exists for a given class, but not inherited, so that the parent can called the child's function, since otherwise it would result in an infinite recursion..</p>
  
  <p>edit:</p>
  
  <p>it actually gives a maximum stack level error, which is the same.</p>
  
  <p>the equivalent code would be:</p>
  
  <pre><code>class A(object):
      def f(x):
          b = B()
          b.f()
  
  class B(A):
      pass
  
  a = A()
  a.f()
  </code></pre>
  
  <p>i understand this is not clean or preferred, but it is what the template translates to, and I dunno how to check for it otherwise.</p>