changeset 840:7ccce98da2b6

added forget function to memo in dataset_ops.memo
author James Bergstra <bergstrj@iro.umontreal.ca>
date Thu, 22 Oct 2009 18:52:12 -0400
parents 2418dad01307
children d7ee9c906d7e
files pylearn/dataset_ops/memo.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/dataset_ops/memo.py	Thu Oct 22 18:51:45 2009 -0400
+++ b/pylearn/dataset_ops/memo.py	Thu Oct 22 18:52:12 2009 -0400
@@ -17,6 +17,10 @@
         if args not in cache:
             cache[args] = f(*args)
         return cache[args]
+    def forget():
+        for k in cache.keys():
+            del cache[k]
+    rval.forget = forget
     rval.__name__ = 'memo@%s'%f.__name__
     return rval