[Python-3000] PEP 3137 plan of attack
Joel Bender
jjb5 at cornell.edu
Mon Oct 15 18:20:24 CEST 2007
Speaking from the protocol encoding/decoding view, and one where a
buffer is very similar to a list of small integers...
>> Also what about .replace() and .translate()?
>
>> If they are not done in place should they return a new buffer (PyBytes_)
>> object or a bytes (PyString_) object? [i'd say a buffer (PyBytes_)]
>
> They should return the same type as 'self'.
My preference would be to do the work in place and return None, just
like sorting a list, reversing a list, appending to a list, etc.
>> Alos if not, should we add additional .ireplace() .ilower() etc.. methods to
>> the mutable buffer (PyBytes_)? There are speed advantages to doing many of
>> those in place rather than a data copy.
>
> I'm not sure I see the use case where this matters all that much
> though. Let's say not, if only because it's not in the PEP. ;-)
I would appreciate it if these functions were list-like and not
tuple-like. In extending buffers to support more structure encoding and
decoding functions, it would be nice to carry the expectation that these
extensions mutate the buffer and I can leverage the built-in
functionality to do that.
I am but a small voice in the chorus.
Joel
More information about the Python-3000
mailing list