Fibonacci numbers with memoization runs slow in Python?
<pre><code>def fib(n):
    if n == 1:
        return 0
    if n == 2:
        return 1
    return fib(n-2) + fib(n-1)


def memo(f):
    cache = {}
    def memoized(n):
        if n not in cache:
            cache[n] = f(n)
        return cache[n]
    return memoized

fib1 = memo(fib)
</code></pre>

<p>This code runs really slow on my laptop,
but if I change the name fib1 to fib, then everything works fine...anyone know the reason ? Thanks!</p>
