[Python-Dev] PEP 467: Minor API improvements for bytes & bytearray

Ethan Furman ethan at stoneleaf.us
Mon Aug 18 03:44:23 CEST 2014


On 08/17/2014 02:19 PM, Raymond Hettinger wrote:
> On Aug 17, 2014, at 11:33 AM, Ethan Furman wrote:
>
>> I've had many of the problems Nick states and I'm also +1.
>
> There are two code snippets below which were taken from the standard library.

[...]

My issues are with 'bytes', not 'bytearray'.  'bytearray(10)' actually makes sense.  I certainly have no problem with 
bytearray and bytes not being exactly the same.

My primary issues with bytes is not being able to do b'abc'[2] == b'c', and with not being able to do x = b'abc'[2]; y = 
bytes(x); assert y == b'c'.

And because of the backwards compatibility issues I would deprecate, because we have a new 'better' way, but not remove, 
the current functionality.

I pretty much agree exactly with what Donald Stufft said about it.

--
~Ethan~


More information about the Python-Dev mailing list