[Numpy-discussion] memmap, write through and flush

Scott Sinclair scott.sinclair.za@gmail....
Thu Aug 13 00:36:00 CDT 2009


> 2009/8/12 Robert Kern <robert.kern@gmail.com>:
> On Sat, Aug 8, 2009 at 21:33, Tom Kuiper<kuiper@jpl.nasa.gov> wrote:
>> There is something curious here.  The second flush() fails.  Can anyone
>> explain this?
>
> numpy.append() does not append values in-place. It is just a
> convenience wrapper for numpy.concatenate().

Meaning that a copy of the data is returned in an ndarray, so when you do

fp = np.append(fp, [[12,13,14,15]], 0)

The name fp is no longer bound to a memmap, hence

AttributeError: 'numpy.ndarray' object has no attribute 'flush'

Cheers,
Scott


More information about the NumPy-Discussion mailing list