Closed gene1wood closed 8 years ago
This is breaking because the functions are not being called in the same way. If you change your "without syntactic sugar" invocation from
big_bar = cache.memoize(big_bar)
to
big_bar = cache.memoize(timeout=50)(big_bar)
you should see identical behavior.
First, this is most likely due to my own misunderstanding of how
memoize
is used and hence the best thing to come out of this issue might be a documentation change.When using the
memoize
decorator with the@
symbol syntactic sugar described in the memoize documentation everything works as described.When I manually instantiate
memoize
without the@
symbol, I get the errormemoize() takes exactly 1 argument
Here is a code block that illustrates the differing behavior with
memoize
and compares it to a typical decorator (in this case the one used in wikipedia to illustrate decorators)Using memoize as described in the documentation
Using memoize without the syntactic sugar
Using a typical decorator with syntactic sugar
Using a typical decorator without syntactic sugar