[Python-Dev] O(1) deletes from the front of bytearray (was: Re: Adding bytes.frombuffer() constructor to PEP 467 (was: [Python-ideas] Adding bytes.frombuffer() constructor)

Nathaniel Smith njs at pobox.com
Wed Oct 12 17:14:48 EDT 2016


On Wed, Oct 12, 2016 at 4:55 AM, Victor Stinner
<victor.stinner at gmail.com> wrote:
> 2016-10-12 10:01 GMT+02:00 Nathaniel Smith <njs at pobox.com>:
>> It's more complicated than that -- the right algorithm is the one that
>> Antoine implemented in 3.4.
>> (...)
>> My point is that
>> forcing everyone who writes network code in Python to do that is
>> silly, especially given that CPython's apparently been shipping this
>> feature for years.
>
> "For years" means since March 2014, Python 3.4.0 release, so 2 years ago.
>
> We can document the optimization as a CPython implementation detail
> and explain that it's only in Python >= 3.4.
>
> So an application which should work on Python 2.7 as well cannot rely
> on this optimization for example.

The proposal is that it should be documented as being part of the
language spec starting in 3.4 (or whatever). So applications that
support Python 2.7 can't rely on it, sure. But if I have an
application that requires, say, 3.5+ but I don't want to depend on
CPython-only implementation details, then I'm still allowed to use it.

AFAIK basically the only project that would be affected by this is
PyPy, and I when I asked on #pypy they said:

<cfbolz> njs`: I think we either plan to or already support this

so I'm not sure why this is controversial.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Python-Dev mailing list