summaryrefslogtreecommitdiff
path: root/numpy/lib/io.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/io.py')
-rw-r--r--numpy/lib/io.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/numpy/lib/io.py b/numpy/lib/io.py
index 3464b568c..9199a0de2 100644
--- a/numpy/lib/io.py
+++ b/numpy/lib/io.py
@@ -118,6 +118,27 @@ class NpzFile(object):
else:
raise KeyError, "%s is not a file in the archive" % key
+
+ def __iter__(self):
+ return iter(self.files)
+
+ def items(self):
+ return [(f, self[f]) for f in self.files]
+
+ def iteritems(self):
+ for f in self.files:
+ yield (f, self[f])
+
+ def keys(self):
+ return self.files
+
+ def iterkeys(self):
+ return self.__iter__()
+
+ def __contains__(self, key):
+ return self.files.__contains__(key)
+
+
def load(file, mmap_mode=None):
"""
Load a pickled, ``.npy``, or ``.npz`` binary file.