memoryview (was "len() on mutables vs. immutables")

Demian Brecht demianbrecht at
Fri Feb 8 07:24:49 CET 2013

On 2013-02-07 8:30 PM, "Terry Reedy" <tjreedy at> wrote:
>So you may assume

I've been bitten far too many times by incorrect assumptions about
implementations that ended up actually doing something quite silly. Having
said that, I felt fairly safe in making that assumption with Python, but
figured I'd write something about my findings as I dug around the source
in order to answer the question for myself.

Still wondering about memoryview though:

If a memoryview (3+) is representing a non-continuguous block of memory (>
ndim), will len(obj) not return incorrect results? It seems to be
reporting the shape of the 0th dim at the moment.. Or is there something
that I'm missing altogether?

More information about the Python-list mailing list