title: Calling a method within another method in the context of @property
body: <p>With the following sample code containing @property decorators:</p>
  
  <pre><code>class Grade_Calculator(object):
      def __init__(self,score):
          self.score = score
  
      @property
      def grade(self):
          if self.score in range(60,70):
              grade = 'D'
          elif self.score in range(70,80):
              grade = 'C'
          elif self.score in range(80,90):
              grade = 'B'
          elif self.score in range(90,101):
              grade = 'A'
          return grade
  
      @property
      def failure(self):
          if self.score &lt; 60:
              print 'See me'
              grade = 'F'
              return grade
  </code></pre>
  
  <p>and an instance:</p>
  
  <pre><code>g = Grade_Calculator(28)
  </code></pre>
  
  <p><code>g.grade</code> returns an <code>UnboundLocalError</code>.  I would like to call <code>failure()</code> within <code>grade()</code> to avoid this error.</p>
  
  <p>With an instance:</p>
  
  <pre><code>g = Grade_Calculator(89)
  </code></pre>
  
  <p><code>g.failure()</code> fails silently. I would like to call <code>grade()</code> within <code>failure()</code> to act as a fail-safe in this situation.</p>
  
  <p>I've seen a lot of references to just doing <code>self.method()</code> calls, but they're not working for me and I think the presence of the decorator is screwing me up somehow:</p>
  
  <pre><code>@property
  def grade(self):
      if self.score &lt; 60:
          self.failure()
      elif self.score in range(60,70):
          grade = 'D'
      elif self.score in range(70,80):
          grade = 'C'
      elif self.score in range(80,90):
          grade = 'B'
      elif self.score in range(90,101):
          grade = 'A'
      return grade
  
  g = Grade_Calculator(28)
  g.grade
  See me
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-667-fb10e6cf27d4&gt; in &lt;module&gt;()
  ----&gt; 1 g.grade
  
  ./sample.py in grade(self)
        6     def grade(self):
        7         if self.score &lt; 60:
  ----&gt; 8             self.failure()
        9         elif self.score in range(60,70):
       10             grade = 'D'
  
  TypeError: 'str' object is not callable
  </code></pre>
  
  <p>What am I not understanding?</p>