Show More
@@ -450,7 +450,7 b' extendeddateformats = defaultdateformats' | |||||
450 | def cachefunc(func): |
|
450 | def cachefunc(func): | |
451 | '''cache the result of function calls''' |
|
451 | '''cache the result of function calls''' | |
452 | # XXX doesn't handle keywords args |
|
452 | # XXX doesn't handle keywords args | |
453 |
if func. |
|
453 | if func.__code__.co_argcount == 0: | |
454 | cache = [] |
|
454 | cache = [] | |
455 | def f(): |
|
455 | def f(): | |
456 | if len(cache) == 0: |
|
456 | if len(cache) == 0: | |
@@ -458,7 +458,7 b' def cachefunc(func):' | |||||
458 | return cache[0] |
|
458 | return cache[0] | |
459 | return f |
|
459 | return f | |
460 | cache = {} |
|
460 | cache = {} | |
461 |
if func. |
|
461 | if func.__code__.co_argcount == 1: | |
462 | # we gain a small amount of time because |
|
462 | # we gain a small amount of time because | |
463 | # we don't need to pack/unpack the list |
|
463 | # we don't need to pack/unpack the list | |
464 | def f(arg): |
|
464 | def f(arg): | |
@@ -700,7 +700,7 b' def lrucachefunc(func):' | |||||
700 | '''cache most recent results of function calls''' |
|
700 | '''cache most recent results of function calls''' | |
701 | cache = {} |
|
701 | cache = {} | |
702 | order = collections.deque() |
|
702 | order = collections.deque() | |
703 |
if func. |
|
703 | if func.__code__.co_argcount == 1: | |
704 | def f(arg): |
|
704 | def f(arg): | |
705 | if arg not in cache: |
|
705 | if arg not in cache: | |
706 | if len(cache) > 20: |
|
706 | if len(cache) > 20: |
General Comments 0
You need to be logged in to leave comments.
Login now