Show More
@@ -188,6 +188,13 b' extendeddateformats = defaultdateformats' | |||||
188 | def cachefunc(func): |
|
188 | def cachefunc(func): | |
189 | '''cache the result of function calls''' |
|
189 | '''cache the result of function calls''' | |
190 | # XXX doesn't handle keywords args |
|
190 | # XXX doesn't handle keywords args | |
|
191 | if func.func_code.co_argcount == 0: | |||
|
192 | cache = [] | |||
|
193 | def f(): | |||
|
194 | if len(cache) == 0: | |||
|
195 | cache.append(func()) | |||
|
196 | return cache[0] | |||
|
197 | return f | |||
191 | cache = {} |
|
198 | cache = {} | |
192 | if func.func_code.co_argcount == 1: |
|
199 | if func.func_code.co_argcount == 1: | |
193 | # we gain a small amount of time because |
|
200 | # we gain a small amount of time because |
General Comments 0
You need to be logged in to leave comments.
Login now