On 10/12/07, Gregory P. Smith <[EMAIL PROTECTED]> 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/) _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
