title: How to call static method from inside of a class body?
body: <p>Let's assume I have a class, with a static method, and I want a class property to be set to the value that this method returns:</p>
  
  <pre><code>class A:
      @staticmethod
      def foo():
          return 12
  
       baz = foo()
  </code></pre>
  
  <p>But doing this I get an error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "&lt;stdin&gt;", line 5, in A
  TypeError: 'staticmethod' object is not callable
  </code></pre>
  
  <p>I found a way to get around this:</p>
  
  <pre><code>class A:
      class B:
          @staticmethod
          def foo():
              return 2
  baz = B.foo()
  </code></pre>
  
  <p>But for example if I write:</p>
  
  <pre><code>class A:
      class B:
          @staticmethod
          def foo():
              return 2
  
      class C:
          baz = B.foo()
  </code></pre>
  
  <p>I also get an error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "&lt;stdin&gt;", line 6, in A
    File "&lt;stdin&gt;", line 7, in C
  NameError: name 'B' is not defined
  </code></pre>
  
  <p>Is there a way to call static methods from within a class while declaring it?
  Why 1st and 3rd examples of code does not work but 2nd does? How python interpretor handles such declarations?</p>