![](https://secure.gravatar.com/avatar/6194b135cba546afa82516de1537de49.jpg?s=120&d=mm&r=g)
Hi, I have a (UInt16) 3d data stack and want to get to it's underlying buffer (to (later) feed it into memmap) ... I noticed that len(pr2._flat) is half of len(pr2._data) - like it doesn't multiply itemsize in.
Is this a bug or am I missunderstanding ? Thanks, Sebastian Haase
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Wed, 2004-10-27 at 12:58, Sebastian Haase wrote:
No.
or am I missunderstanding ?
Yes. _data is "an object which supports the buffer protocol". In this context, it is effectively a string and thus the product of the total number of elements and the itemsize. (We'll ignore for now the fact that not every array uses the entire buffer.) In contrast, shape(.flat) is only the total number of elements and is independent of itemsize. Regards, Todd
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Wed, 2004-10-27 at 12:58, Sebastian Haase wrote:
No.
or am I missunderstanding ?
Yes. _data is "an object which supports the buffer protocol". In this context, it is effectively a string and thus the product of the total number of elements and the itemsize. (We'll ignore for now the fact that not every array uses the entire buffer.) In contrast, shape(.flat) is only the total number of elements and is independent of itemsize. Regards, Todd
participants (2)
-
Sebastian Haase
-
Todd Miller