[Numpy-discussion] Views of memmaps and offset

Gael Varoquaux gael.varoquaux@normalesup....
Sat Sep 22 12:31:11 CDT 2012


On Sat, Sep 22, 2012 at 06:30:27PM +0200, Olivier Grisel wrote:
> The only clean solution would be to make `numpy.memmap` use a wrapper
> buffer object that would keep track of the filename and offset
> attributes instead of using a `mmap.mmap` instance directly.

Indeed, Olivier and I have been struggling to find a solution to our
problem: knowing whether the data in an array is a view on a file, and if
so which file. This was possible in previous numpy versions, by going up
the chain of 'base' references, and looking on the top-most object. It is
no longer possible as the base now is a Python mmap that does not keep
track of this information.

Would people agree with a patch proposing to change the base of an
np.memmap with a wrapper on the Python mmap keeping track of this
information?

If so, we'll try to submit a patch quickly.

Gaël


More information about the NumPy-Discussion mailing list