[Python-3000] PEP 3137 plan of attack
Guido van Rossum
guido at python.org
Sat Oct 13 03:20:44 CEST 2007
On 10/12/07, Gregory P. Smith <greg at krypto.org> wrote:
> > > - add missing methods to PyBytes (for list, see the PEP and compare to
> > > what's already there)
>
> As I work on these.. Should the mutable PyBytes_ (buffer) objects implement
> the following methods inplace and return an additional reference to self?
>
> .capitalize(), .center(), .expandtabs(), .rjust(), .swapcase(), .title(),
> .upper(), .zfill()
No... That would be a huge trap to fall in at all sorts of occasions.
> 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'.
> 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. ;-)
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list