<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, 7 Jun 2016 at 14:38 Paul Sokolovsky <<a href="mailto:pmiscml@gmail.com">pmiscml@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
On Tue, 7 Jun 2016 17:31:19 -0400<br>
Barry Warsaw <<a href="mailto:barry@python.org" target="_blank">barry@python.org</a>> wrote:<br>
<br>
> On Jun 07, 2016, at 01:28 PM, Ethan Furman wrote:<br>
><br>
> >* Add ``bytes.iterbytes``, ``bytearray.iterbytes`` and<br>
> >   ``memoryview.iterbytes`` alternative iterators<br>
><br>
> +1 but I want to go just a little farther.<br>
><br>
> We can't change bytes.__getitem__ but we can add another method that<br>
> returns single byte objects?  I think it's still a bit of a pain to<br>
> extract single bytes even with .iterbytes().<br>
><br>
> Maybe .iterbytes can take a single index argument (blech) or add a<br>
> method like .byte_at(i).  I'll let you bikeshed on the name.<br>
<br>
What's wrong with b[i:i+1] ?<br></blockquote><div><br></div><div>It always succeeds while indexing can trigger an IndexError. <br></div></div></div>