[Numpy-discussion] ZeroRank memmap behavior?
spitskip at gmail.com
Fri Sep 21 08:59:35 EDT 2012
I'm deeply puzzled by the recently changed behavior of zero-rank memmaps. I
think this change happened from version 1.6.0 to 1.6.1, which I'm currently
>>> import numpy as np
Create a zero-rank memmap.
>>> x = np.memmap(filename='/tmp/m', dtype=float, mode='w+', shape=())
Give it a value:
>>> x[...] = 22
So far so good. But now:
>>> b = (x + x) / 1.5
WT.? Why is the result of this calculation a memmap?
It even thinks that it's still linked to the file, but it's not:
If I try this with arrays then I don't get this weird behavior:
>>> a = np.array(2, dtype=float)
>>> (a + a) / 2.5
which gives me a Python float, not a zero-rank array.
Why does the memmap behave like that? Why do I get a memmap even
though it's not connected to any file?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion