[issue7696] Improve Memoryview/Buffer documentation

Craig McQueen report at bugs.python.org
Mon Jul 12 03:04:57 CEST 2010


Craig McQueen <python at craig.mcqueen.id.au> added the comment:

The documentation implies that memoryview always accesses bytes:
* "len(view) returns the total number of bytes in the memoryview, view."
* "Taking a single index will return a single byte."

But, the following example shows this is misleading:

    >>> from array import array
    >>> ar = array('H', [1,2,3])
    >>> arv = memoryview(ar)
    >>> len(arv)
    3
    >>> arv[1]
    b'\x02\x00'

----------
nosy: +cmcqueen1975

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7696>
_______________________________________


More information about the Python-bugs-list mailing list