diff options
author | Wendell Smith <wendellwsmith@gmail.com> | 2014-11-18 12:08:12 -0500 |
---|---|---|
committer | Wendell Smith <wendellwsmith@gmail.com> | 2014-11-18 14:15:58 -0500 |
commit | 60de33d58f6d1a4f70ebf5af22e8873a36cd3be2 (patch) | |
tree | a043a56c6445e907a61b13c91124cf726fa0e7ca /numpy/lib/npyio.py | |
parent | c2d784595a6e65d5891bb1b76539ef009ea28cc5 (diff) | |
download | numpy-60de33d58f6d1a4f70ebf5af22e8873a36cd3be2.tar.gz |
ENH: add BagObj.__dir__ to numpy.lib.npyio
This allows dir(bagobj), and also enables tab-completion on a BagObj,
which can be useful in an interpreter or IPython
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): |