On 11/1/06, Alexander Belopolsky email@example.com wrote:
Let's just start with that. The way I see the problem is that buffer protocol is fine as long as your data is an array of bytes, but if it is an array of doubles, you are out of luck. So, while I can do
b = buffer(array('d', [1,2,3]))
there is not much that I can do with b. For example, if I want to pass it to numpy, I will have to provide the type and shape information myself:
numpy.ndarray(shape=(3,), dtype=float, buffer=b)
array([ 1., 2., 3.])
With the extended buffer protocol, I should be able to do
As a data point, this is the first posting that has clearly explained to me what the two PEPs are attempting to achieve. That may be my blindness to what others find self-evident, but equally, I may not be the only one who needed this example...