Cult-like behaviour [was Re: Kindness]

Rhodri James rhodri at kynesim.co.uk
Tue Jul 17 08:55:25 EDT 2018


On 17/07/18 02:17, Steven D'Aprano wrote:
> On Mon, 16 Jul 2018 23:50:12 +0200, Roel Schroeven wrote:
> 
>> There are times (encoding/decoding network protocols and other data
>> formats) when I have a byte string and I want/need to process it like
>> Python 2 does, and that is the one area where I feel Python 3 make
>> things a bit more difficult.
> 
> Ah yes, the unfortunate design error that iterating over byte-strings
> returns ints rather than single-byte strings.
> 
> That decision seemed to make sense at the time it was made, but turned
> out to be an annoyance. It's a wart on Python 3, but fortunately one
> which is fairly easily dealt with by a helper function.

I don't think I agree with you, but that may just be my heritage as a C 
programmer.  Every time I've iterated over a byte string, I've really 
meant bytes (as in integers).  Those bytes may correspond to ASCII 
characters, but that's just a detail.

-- 
Rhodri James *-* Kynesim Ltd


More information about the Python-list mailing list