title: staticmethod and recursion?
body: <p>I have following code:</p>
  
  <pre><code>class Foo(object):
      def __init__(self):
          baz=self.bar(10)
  
      @staticmethod
      def bar(n):
          if n==0:
              return 'bar'
          else:
              return bar(n-1)
  </code></pre>
  
  <p>bar() as a recursive function it needs reference to itself. However, bar() is inside a class, and calling <code>return bar(n-1)</code> will not work, invoking <code>NameError: global name 'bar' is not defined</code>. How can I deal with this kind of situation? Should I change bar() to a class or instance method, allowing access to <code>self</code> or <code>cls</code>?</p>