Cult-like behaviour [was Re: Kindness]

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Jul 16 21:17:06 EDT 2018


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.

That *is* a nice example of where byte strings in Python 3 aren't as nice 
as in Python 2.



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson




More information about the Python-list mailing list