title: Why is a line in this python function necessary? (memoized recursion)
body: <p>I got the following code snippet from Peter Norvig's website; it's a decorator to enable memoization on function calls (caching prior calls to the function to change an exponential recursion into a simple dynamic program). </p>
  
  <pre><code>def memo(f):
      table = {}
      def fmemo(*args):
          if args not in table:
              table[args] = f(*args)
          return table[args]
      fmemo.memo = table
      return fmemo
  </code></pre>
  
  <p>The code works fine, but I'm wondering why the second to last line is necessary. This is clearly a gap in my knowledge of Python, but removing the line and running a simple fibonacci function, it still seems to work. Does this have to do with memoizing multiple functions simultaneously? Why would the member variable of fmemo be called memo (assuming it's not an awkward coincidence)?</p>
  
  <p>Thanks!</p>