summaryrefslogtreecommitdiff
path: root/numpy/dual.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-01-19 03:01:27 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-01-19 03:01:27 +0000
commit6a30aaf84be313b29a4072ec3357ff5e4a6b2d74 (patch)
treefaaa569c6f58cf3fda466da8949cb066f66c284a /numpy/dual.py
parent107c7d31a655be8fdf0c58ea7274ec98149d56fd (diff)
downloadnumpy-6a30aaf84be313b29a4072ec3357ff5e4a6b2d74.tar.gz
Add restore functions to numpy.dual
Diffstat (limited to 'numpy/dual.py')
-rw-r--r--numpy/dual.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/numpy/dual.py b/numpy/dual.py
index 00a1f04fa..e6e8884b5 100644
--- a/numpy/dual.py
+++ b/numpy/dual.py
@@ -43,7 +43,13 @@ def restore_func(name):
if name not in __all__:
raise ValueError, "%s not a dual function." % name
try:
- sys._getframe(0).f_globals[name] = _restore_dict[name]
+ val = _restore_dict[name]
except KeyError:
- pass
-
+ return
+ else:
+ sys._getframe(0).f_globals[name] = val
+
+def restore_all():
+ for name in _restore_dict.keys():
+ restore_func(name)
+