I'm a Python newbie, and that code was immediately clear and obvious to me when I read it.
I won't say it would be clear anyone that reads it, because we live in a world where people who claim to be programmers can't do fizz buzz.
I won't say it would be clear anyone that reads it, because we live in a world where people who claim to be programmers can't do fizz buzz.
Add a @memoize decorator and do it there, you need to always be as obvious as possible. Compare:
@memoize
def fibonacci(n): pass
def fibonacci(n, memory=[]): pass
You don't even need documentation for the first example.