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 using.
>>> 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 >>> x memmap(22.0) So far so good. But now: >>> b = (x + x) / 1.5 >>> b memmap(29.333333333333332) 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: >>> b.filename '/tmp/m' If I try this with arrays then I don't get this weird behavior: >>> a = np.array(2, dtype=float) >>> (a + a) / 2.5 1.6000000000000001 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? Regards, Wim
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
