bytearray inconsistencies?

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Dec 21 07:29:14 EST 2013


On 21/12/2013 01:58, Ned Batchelder wrote:
>
> If you have a zero, you can split on it with:
> bytestring.split(bytes([0])), but that doesn't explain why find can take
> a simple zero, and split has to take a bytestring with a zero in it.
>

Create a bytearray(range(256)) and partition it on 128.  I'd expect to 
see the original effectively cut in half with 128 as the separator.  You 
actually get the original with two empty bytearrays, which makes no 
sense to me at all.

I also looked in test_bytes.py, read as far as "XXX This is a mess" and 
promptly gave up.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list