diff options
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r-- | numpy/lib/npyio.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 641203f34..cbef1a6e2 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -122,6 +122,14 @@ class BagObj(object): return object.__getattribute__(self, '_obj')[key] except KeyError: raise AttributeError(key) + + def __dir__(self): + """ + Enables dir(bagobj) to list the files in an NpzFile. + + This also enables tab-completion in an interpreter or IPython. + """ + return object.__getattribute__(self, '_obj').keys() def zipfile_factory(*args, **kwargs): |