[Python-Dev] bytes & bytearray

Paul Sokolovsky pmiscml at gmail.com
Mon Jan 19 23:22:02 CET 2015


Hello,

On Mon, 19 Jan 2015 14:03:20 -0800
Guido van Rossum <guido at python.org> wrote:

> On Mon, Jan 19, 2015 at 11:43 AM, Paul Sokolovsky <pmiscml at gmail.com>
> wrote:
> 
> > [...]
> > So, suppose there's a requirement to support inplace operations
> > (methods) on bytearray, what would be Pythonic way to implement it?
> >
> > Something like:
> >
> > b.lower_inplace()
> > b.lower_i()
> >
> > , or maybe
> >
> > import bytearray_ops
> > bytearray_ops.lower(b)
> >
> > ?
> 
> 
> Please don't go there. The use cases are too rare.

recv_into() an HTTP request and .lower() it inplace to ease parsing?
But I mostly raise that with MicroPython hat on, there it may be not
necessarily superfluous. But then, having a separate module for such
operations doesn't seem too bad, except that it would be retrograde
action after "string" module deprecation in favor of methods.

Anyway, I targetted that question for python-ideas on some easy day, and
just took a quick chance here seeing someone else talking about inplace
bytearray operations ;-).

> 
> -- 
> --Guido van Rossum (python.org/~guido)


-- 
Best regards,
 Paul                          mailto:pmiscml at gmail.com


More information about the Python-Dev mailing list