[Python-Dev] Fwd: PEP 467: Minor API improvements for bytes & bytearray

Guido van Rossum guido at python.org
Mon Aug 18 02:45:32 CEST 2014

On Sun, Aug 17, 2014 at 5:22 PM, Barry Warsaw <barry at python.org> wrote:

> On Aug 18, 2014, at 10:08 AM, Nick Coghlan wrote:
> >There's actually another aspect to your idea, independent of the naming:
> >exposing a view rather than just an iterator. I'm going to have to look at
> >the implications for memoryview, but it may be a good way to go (and would
> >align with the iterator -> view changes in dict).
> Yep!  Maybe that will inspire a better spelling. :)

+1. It's just as much about b[i] as it is about "for c in b", so a view
sounds right. (The view would have to be mutable for bytearrays and for
writable memoryviews.)

On the rest, it's sounding more and more as if we will just need to live
with both bytes(1000) and bytearray(1000). A warning sounds worse than a
deprecation to me.

bytes.zeros(n) sounds fine to me; I value similar interfaces for bytes and
bytearray pretty highly.

I'm lukewarm on bytes.byte(c); but bytes([c]) does bother me because a size
one list is (or at least feels) more expensive to allocate than a size one
bytes object. So, okay.

--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140817/47ad50e1/attachment.html>

More information about the Python-Dev mailing list