[SciPy-dev] Using memoryviews

Neal Becker ndbecker2@gmail....
Tue Nov 25 12:45:14 CST 2008


This discussion might be of interest (from python-3000.devel):

Antoine Pitrou wrote:

> Josiah Carlson <josiah.carlson <at> gmail.com> writes:
>> 
>> From what I understand of the memoryview when I tried to do the same
>> thing a few months ago (use memoryview to replace buffer in
>> asyncore/asynchat), memoryview is incomplete.  It didn't support
>> character buffer slicing (you know, the 'offset' and 'size' arguments
>> that were in buffer), and at least a handful of other things (that I
>> can't remember at the moment).
> 
> You should try again, memoryview now supports slicing (with the usual
> Python syntax, e.g. m[2:5]) as well as slice assignment (with the fairly
> sensible limitation that you can't resize the underlying buffer). There's
> no real doc for it, but you can look at test_memoryview.py in the Lib/test
> directory to have a fairly comprehensive list of the things currently
> supported.
> 
> I also support the addition of official functions or macros to access the
> underlying fields of the Py_buffer struct, rather than access them
> directly from 3rd party code. Someone please open an issue for that in the
> tracker.
> 
> The big, big limitation of memoryviews right now is that they only support
> one-dimensional byte buffers. The people interested in more complex
> arrangements (that is, Scipy/Numpy people) have been completely absent
> from the python-dev community for many months now, and I don't think
> anyone else cares enough to do the job instead of them.
> 
> Regards
> 
> Antoine.




More information about the Scipy-dev mailing list