A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-September/103399.html below:

[Python-Dev] Buffer protocol for io.BytesIO?

[Python-Dev] Buffer protocol for io.BytesIO? [Python-Dev] Buffer protocol for io.BytesIO?Nick Coghlan ncoghlan at gmail.com
Thu Sep 2 23:22:31 CEST 2010
On Fri, Sep 3, 2010 at 6:35 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>
> Hello all,
>
> In issue #5506, I originally proposed that io.BytesIO objects support
> the buffer protocol, to make it possible to access the internal buffer
> without intermediate copies.
>
> Then it came to me then perhaps it would be too automatic. So I'm
> currently floating between:
> - add implicit buffer protocol support to BytesIO objects
> - add explicit buffer protocol support through the call of a
>  getbuffer() method, which would return a small intermediate object
>  supporting the buffer protocol on behalf of the original BytesIO
>  object
>
> What do you think would be better?

The latter offers an easy future upgrade path if we decide that
implicit would be better (i.e. change getbuffer() to just return
self). If we go straight to implicit there's no easy way back to the
explicit version.

I think getbuffer() also parallels getvalue() quite well.

Call it +1 for explicit and -0 for implicit.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4