[Python-Dev] PEP 467: Minor API improvements to bytes, bytearray, and memoryview (original) (raw)

Brett Cannon brett at python.org
Tue Jun 7 17:40:35 EDT 2016


On Tue, 7 Jun 2016 at 14:38 Paul Sokolovsky <pmiscml at gmail.com> wrote:

Hello,

On Tue, 7 Jun 2016 17:31:19 -0400 Barry Warsaw <barry at python.org> wrote: > On Jun 07, 2016, at 01:28 PM, Ethan Furman wrote: > > >* Add bytes.iterbytes, bytearray.iterbytes and > > memoryview.iterbytes alternative iterators > > +1 but I want to go just a little farther. > > We can't change bytes.getitem but we can add another method that > returns single byte objects? I think it's still a bit of a pain to > extract single bytes even with .iterbytes(). > > Maybe .iterbytes can take a single index argument (blech) or add a > method like .byteat(i). I'll let you bikeshed on the name. What's wrong with b[i:i+1] ?

It always succeeds while indexing can trigger an IndexError. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160607/d882821f/attachment-0001.html>



More information about the Python-Dev mailing list