[Python-Dev] Adding bytes.frombuffer() constructor to PEP 467

Nikolaus Rath Nikolaus at rath.org
Wed Oct 12 11:35:09 EDT 2016


On Oct 11 2016, Nathaniel Smith <njs at pobox.com> wrote:
> On Tue, Oct 11, 2016 at 9:08 PM, INADA Naoki <songofacandy at gmail.com> wrote:
>> From Python 3.4, bytearray is good solution for I/O buffer, thanks to
>> #19087 [1].
>> Actually, asyncio uses bytearray as I/O buffer often.
>
> Whoa what?! This is awesome, I had no idea that bytearray had O(1)
> deletes at the front. I literally reimplemented this myself on type of
> bytearray for some 3.5-only code recently because I assumed bytearray
> had the same asymptotics as list, and AFAICT this is totally
> undocumented. 

Indeed, same here.


Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«


More information about the Python-Dev mailing list