@decorator syntax is sugar, but for what exactly? (decorator libraries).
skip at pobox.com
Wed Aug 11 16:55:32 CEST 2004
>> Yes (using a class instead of a module simply for convenience):
Art> Is it me, or this a chilling argument agaisnt where things are
I'm not sure what you're getting at. Nobody said a decorator's
implementation had to be simple. It can, after all, perform pretty
Art> But when there is a lot less going on than meets the eye ...
Again, I'm confused. Look at just the fib() definition:
assert n >= 0
if n <= 1:
return n + fib(n-1)
The decorator says the function will be memoized. That memoizing an
arbitrary function's values using a dict isn't entirely straightforward
shouldn't prevent people from being able to easily memoize functions whose
outputs only depend on their inputs. By analogy, I use urllib.urlopen() all
the time without completely understanding all the ins and outs of what it
Perhaps the decorator would be better named "idempotent"?
Or were you objecting to something else?
More information about the Python-list