Earlier quoted context omitted.
Thank you. This is good to know. I was rather frustrated to find binary data handling being changed with no easy translation in Python 3. Here is another annoyance: In [207]: 'abc'[0] + 'def' Out[207]: 'adef' In [208]: b'abc'[0] + b'def' --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () ----> 1 b'abc'[0] + b'def' TypeError: unsupported operan…
I don't have enough experience with either version to debate the merits of the choice, but the way forward with python 3 is to think of bytes objects as more like special lists of ints, where if you want a slice (instead of a single element) you have to ask for it: >>> [1,2,3][0] 1 >>> [1,2,3][0:1] [1] >>> b'abc'[0] 97 >>> b'abc'[0:1] b'a' >>> So the construction you want is just: >>> b'abc'[0:1]+b'def' b'adef' Which…
So in Python 3 the design of binary string is changed. Unlike the old string, bytes and binary string of length 1 are not the same. Working codes are broken, practice have to be changed, often it involves more complicated code (like [0] becomes [0:1]). All these happens with no apparent benefit other than it is more "coherent" in the eye of some people. This is the frustration I see after using Python 3 for some time.