Show More
@@ -26,8 +26,11 b' class SignalInterrupt(Exception):' | |||||
26 |
|
26 | |||
27 | def cachefunc(func): |
|
27 | def cachefunc(func): | |
28 | '''cache the result of function calls''' |
|
28 | '''cache the result of function calls''' | |
|
29 | # XXX doesn't handle keywords args | |||
29 | cache = {} |
|
30 | cache = {} | |
30 | if func.func_code.co_argcount == 1: |
|
31 | if func.func_code.co_argcount == 1: | |
|
32 | # we gain a small amount of time because | |||
|
33 | # we don't need to pack/unpack the list | |||
31 | def f(arg): |
|
34 | def f(arg): | |
32 | if arg not in cache: |
|
35 | if arg not in cache: | |
33 | cache[arg] = func(arg) |
|
36 | cache[arg] = func(arg) |
General Comments 0
You need to be logged in to leave comments.
Login now