Message142820
I think this would be useful and I'll try it out in features/pep-3118#memoryview.
Syntax options that I'd prefer:
a = array.array('i', [1,2,3])
m = memoryview(a, 'B')
Or go all the way and make memoryview take any flag:
a = array.array('i', [1,2,3])
m = memoryview(a, getbuf=PyBUF_SIMPLE)
This is what I currently do in _testbuffer.c:
>>> from _testbuffer import *
>>> import array
>>> a = array.array('i', [1,2,3])
>>> nd = ndarray(a, getbuf=PyBUF_SIMPLE)
>>> nd.format
''
>>> nd.len
12
>>> nd.shape
()
>>> nd.strides
()
>>> nd.itemsize # XXX array_getbuf should set this to 1.
4
We would need to fix various getbuffer() methods to adhere to
strict rules that I've posed here:
http://mail.scipy.org/pipermail/numpy-discussion/2011-August/058189.html |
|
Date |
User |
Action |
Args |
2011-08-23 13:10:41 | skrah | set | recipients:
+ skrah, gregory.p.smith, teoliphant, mark.dickinson, ncoghlan, pitrou, vstinner, xuanji, jcon |
2011-08-23 13:10:41 | skrah | set | messageid: <1314105041.26.0.783764134984.issue5231@psf.upfronthosting.co.za> |
2011-08-23 13:10:40 | skrah | link | issue5231 messages |
2011-08-23 13:10:40 | skrah | create | |
|