how to get bytes from bytearray without copying

Ian Kelly ian.g.kelly at gmail.com
Sun Mar 2 19:55:48 EST 2014


On Sun, Mar 2, 2014 at 5:44 PM, Cameron Simpson <cs at zip.com.au> wrote:
> Have you considered subclassing memoryview and giving the subclass
> a __hash__ method?

>>> class MyMemoryView(memoryview):
...     def __hash__(self): return 42
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: type 'memoryview' is not an acceptable base type



More information about the Python-list mailing list