<br><br><div><span class="gmail_quote">On 1/12/07, <b class="gmail_sendername">Travis Oliphant</b> <<a href="mailto:firstname.lastname@example.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">email@example.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Neal Becker wrote:<br>> I believe we are converging, and this is pretty much the same design as I<br>> advocated. It is similar to boost::ublas.<br>><br>I'm grateful to hear that. It is nice when ideas come from several
<br>different corners.<br>> Storage is one concept.<br>><br>> Interpretation of the storage is another concept.<br>><br>> Numpy is a combination of a storage and interpretation.<br>><br>> Storage could be dense or sparse. Allocated in various ways. Sparse can be
<br>> implemented in different ways.<br>><br>> Interpretation can be 1-d, 2-d. Zero-based, non-zero based. Also there is<br>> question of ownership (slices).<br>><br><br>How do we extend the buffer interface then? Do we have one API that
<br>allows sharing of storage and another that handles sharing of<br>interpretation?<br><br>How much detail should be in the interface regarding storage detail.<br>Is there a possibility of having at least a few storage models
<br>"shareable" so that memory can be shared by others that view the data in<br>the same way?</blockquote><div><br><br>I'm concerned about the direction that this PEP seems to be going. The original proposal was borderline too complicated IMO, and now it seems headed in the direction of more complexity.
<br><br>Also, it seems that there are three different goals getting conflated here. None are bad, but they don't and probably shouldn't, all be addressed by the same PEP.<br><ol><li>Allowing producers and consumers of blocks of data to share blocks efficiently. This is half of what the original PEP proposed.
<br></li><li>Describing complex data types at the c-level. This is the other half of the PEP.<br></li><li>Things that act like arrays, but have different storage methods. This details of this still seem pretty vague, but to the extent that I can figure them out, it doesn't seem useful or necessary to tie this into the rest of the array interface PEP. For example, "array_interface->get_block_from_slice()" has been mentioned. Why that instead of "PyObject_AsExtendedBuffer(PyObject_GetItem(index), ....)". I'll stop here, till I see some more details of what people have in mind, but at this point, I think that alternative memory models are a different problem that should be addressed separately.
<br></li></ol> Sadly, I'm leaving town shortly and I'm running out of time, so I'll have to leave my objections in this somewhat vague state.<br><br>Oh, the way that F. Lundh plans to expose PIL's data a chunk at a time is mentioned in this python-dev summary:
<br><div style="margin-left: 40px;"><a href="http://www.python.org/dev/summary/2006-11-01_2006-11-15/">http://www.python.org/dev/summary/2006-11-01_2006-11-15/</a><br></div>It doesn't seem necessary to have special support for this; all that is necessary is for the object returned by acquire_view to support the extended array protocol.
<br></div><br></div> Remind me again why we can't simply use ctypes for this? It's already in the core. I'm sure it's less efficient, but you shouldn't need to parse the data structure information very often. I suspect that something that leveraged ctypes would meet less resistance.
<br><br> Which reminds me. I never saw in the PEP what the actual call in the buffer protocol was supposed to look like. Is it something like:<br><div style="margin-left: 40px;">PyObject_AsExtendedBuffer(PyObject *<var>
obj</var>, void **<var><font style="background-color: rgb(49, 106, 197);" color="#ffffff">buffer</font></var>, Py_ssize_t *<var><font style="background-color: rgb(49, 106, 197);" color="#ffffff">buffer</font>_len, funcptr *bf_getarrayview, funcptr *bf_relarrayview)
<br></var></div>?<var></var><br clear="all"><var></var><br>-- <br>//=][=\\<br><br><a href="mailto:firstname.lastname@example.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">email@example.com</a>