From 2ce12c23b31b7a82341d85b4a848433d6d8c401c Mon Sep 17 00:00:00 2001 From: David Sowder Date: Sun, 4 Mar 2012 16:44:47 -0600 Subject: [PATCH] pyflakes helped fixes: cachefunc.py: resolve function redefinition --- cachefunc.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cachefunc.py b/cachefunc.py index d86e38e..765ca47 100644 --- a/cachefunc.py +++ b/cachefunc.py @@ -142,23 +142,23 @@ def lfu_cache(maxsize=100): if __name__ == '__main__': @lru_cache(maxsize=20) - def f(x, y): + def f_lru(x, y): return 3 * x + y domain = range(5) from random import choice for i in range(1000): - r = f(choice(domain), choice(domain)) + r = f_lru(choice(domain), choice(domain)) - print(f.hits, f.misses) + print(f_lru.hits, f_lru.misses) @lfu_cache(maxsize=20) - def f(x, y): + def f_lfu(x, y): return 3 * x + y domain = range(5) from random import choice for i in range(1000): - r = f(choice(domain), choice(domain)) + r = f_lfu(choice(domain), choice(domain)) - print(f.hits, f.misses) + print(f_lfu.hits, f_lfu.misses)