Show More
@@ -188,6 +188,13 b' extendeddateformats = defaultdateformats' | |||
|
188 | 188 | def cachefunc(func): |
|
189 | 189 | '''cache the result of function calls''' |
|
190 | 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 | 198 | cache = {} |
|
192 | 199 | if func.func_code.co_argcount == 1: |
|
193 | 200 | # we gain a small amount of time because |
General Comments 0
You need to be logged in to leave comments.
Login now