Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #67497 > unrolled thread

Re: how to get bytes from bytearray without copying

Started byCameron Simpson <cs@zip.com.au>
First post2014-03-03 12:47 +1100
Last post2014-03-03 12:47 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: how to get bytes from bytearray without copying Cameron Simpson <cs@zip.com.au> - 2014-03-03 12:47 +1100

#67497 — Re: how to get bytes from bytearray without copying

FromCameron Simpson <cs@zip.com.au>
Date2014-03-03 12:47 +1100
SubjectRe: how to get bytes from bytearray without copying
Message-ID<mailman.7616.1393811289.18130.python-list@python.org>
On 02Mar2014 17:55, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Sun, Mar 2, 2014 at 5:44 PM, Cameron Simpson <cs@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

Ah. The slices were going to be an issue too, anyway.

He could write a wrapper class with a __hash__ method, whose slices
themselves are also the wrapper class.

It raises the implementation bar only slightly.

Cheers,
-- 
Cameron Simpson <cs@zip.com.au>

Please do not send me Microsoft Word files.
http://en.nothingisreal.com/wiki/Please_don't_send_me_Microsoft_Word_documents

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web