[Numpy-discussion] Why does asarray() create an intermediate memoryview?
Alexander Belopolsky
ndarray at mac.com
Sun Mar 27 17:00:51 EDT 2016
In the following session a numpy array is created from an stdlib array:
In [1]: import array
In [2]: base = array.array('i', [1, 2])
In [3]: a = np.asarray(base)
In [4]: a.base
Out[4]: <memory at 0x7fb80383e8c8>
In [5]: a.base.obj
Out[5]: array('i', [1, 2])
In [6]: a.base.obj is base
Out[6]: True
Why can't a.base be base? What is the need for the intermediate memoryview
object?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20160327/0d4e4692/attachment.html>
More information about the NumPy-Discussion
mailing list