Re: [Numpy-discussion] Why does asarray() create an intermediate memoryview?

2016-03-27 Thread Pauli Virtanen
Sun, 27 Mar 2016 17:00:51 -0400, Alexander Belopolsky kirjoitti: [clip] > Why can't a.base be base? What is the need for the intermediate > memoryview object? Implementation detail vs. life cycle management of buffer acquisitions. The PEP3118 Py_buffer structure representing an acquired buffer i

[Numpy-discussion] Why does asarray() create an intermediate memoryview?

2016-03-27 Thread Alexander Belopolsky
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]: 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