Open numpy-gitbot opened 12 years ago
Attachment added by atmention:dwf on 2009-06-03: io.py.diff
atmention:dwf wrote on 2009-06-03
Oops. That should be __contains__
, __iter__
.
atmention:dwf wrote on 2009-06-04
I just noticed the base classes defined in the "collections" module. I wonder if we should be inheriting from collections.Mapping, even though not all of the interface can be efficiently implemented.
atmention:pv wrote on 2009-06-04
We can't inherit from collections.Mapping, since Python 2.4 compatibility needs to be maintained.
atmention:dwf wrote on 2009-06-04
Good point. In that case, maybe we should inherit from [http://docs.python.org/library/userdict.html#UserDict.DictMixin UserDict.DictMixin], with a comment to the effect that this should eventually be deprecated in favour of collections.Mapping?
Milestone changed to Unscheduled
by atmention:cournape on 2009-11-27
Original ticket http://projects.scipy.org/numpy/ticket/1125 on 2009-06-03 by atmention:dwf, assigned to unknown.
The patch attached implements a more complete dictionary interface for NpzFile. That is to say, it provides (in addition to the already present getitem()):
This allows the convenient "for fname in mynpzfile" syntax, as well as letting you write code that doesn't care whether its input is an in-memory dictionary or a lazily-loaded NpzFile.