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


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

Re: how to get bytes from bytearray without copying

Started byJuraj Ivančić <juraj.ivancic@gmail.com>
First post2014-03-03 10:09 +0100
Last post2014-03-03 10:09 +0100
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 Juraj Ivančić <juraj.ivancic@gmail.com> - 2014-03-03 10:09 +0100

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

FromJuraj Ivančić <juraj.ivancic@gmail.com>
Date2014-03-03 10:09 +0100
SubjectRe: how to get bytes from bytearray without copying
Message-ID<mailman.7630.1393837816.18130.python-list@python.org>
On 3.3.2014. 2:27, Ian Kelly wrote:

> Python 3.3 has a C API function to create a memoryview for a char*,
> that can be made read-only.
>
>      http://docs.python.org/3/c-api/memoryview.html#PyMemoryView_FromMemory

Yes, this is probably what I'll do in absence of pure Python solution. 
Thanks for the tip.

> Or you could bite the bullet and copy everything
> once at the start to create a bytes object, and then never have to
> worry about it again.

That would be a surrender :-)

[toc] | [standalone]


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


csiph-web