On Fri, Sep 3, 2010 at 6:35 AM, Antoine Pitrou <solip...@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 | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com