This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients gregory.p.smith, jcon, mark.dickinson, ncoghlan, pitrou, skrah, teoliphant, vstinner, xuanji
Date 2011-08-23.13:10:40
SpamBayes Score 0.0010590954
Marked as misclassified No
Message-id <1314105041.26.0.783764134984.issue5231@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2011-08-23 13:10:41skrahsetrecipients: + skrah, gregory.p.smith, teoliphant, mark.dickinson, ncoghlan, pitrou, vstinner, xuanji, jcon
2011-08-23 13:10:41skrahsetmessageid: <1314105041.26.0.783764134984.issue5231@psf.upfronthosting.co.za>
2011-08-23 13:10:40skrahlinkissue5231 messages
2011-08-23 13:10:40skrahcreate