Stefan Krah <stefan-use...@bytereef.org> added the comment: 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 ---------- nosy: +skrah _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5231> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com