
April 30, 2009
1:06 p.m.
Steven D'Aprano <steve@...> writes:
-1 on an extra parameter to property.
+1 on a cache decorator.
+1 for calling it "cached" or "memoize". I don't know if it has its place in the builtin namespace, though. Putting it in functools would be fine. (it may need a way to flush/invalidate the cache, too: @cached def foo(l=[4]): l[0] += 1 return 4 print foo() # 5 print foo() # 5 foo.flush() print foo() # 6 )