Martin Panter added the comment:
In my experience, I tend to only use memoryview() for “bytes-like” buffers (but
see Issue 23756 about clarifying what this means). Example from
/Lib/_compression.py:67:
def readinto(self, b):
with memoryview(b) as view, view.cast("B") as byte_view:
data = self.read(len(byte_view))
byte_view[:len(data)] = data
return len(data)
Fixing cast("B") or adding a memoryview(raw=True) mode could probably help when
all you want is a byte buffer.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15944>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com