[Python-Dev] Python 3.x and bytes
ethan at stoneleaf.us
Wed May 18 00:27:45 CEST 2011
The bytes type in Python 3 does not feel very consistent.
--> some_var = 'abcdef'
--> some_other_var = b'abcdef'
On the one hand we have the 'bytes are ascii data' type interface, and
on the other we have the 'bytes are a list of integers between 0 - 256'
interface. And trying to use the two is not intuitive:
--> some_other_var == b'd'
When I'm parsing a .dbf file and extracting field types from the byte
stream, I'm not thinking, "okay, 67 is a Character field" -- what I'm
thinking is, "b'C' is a Character field".
Considering that ord() still works fine, I'm not sure why it was done
Is there code out there that is using this "list of int's" interface, or
is there time to make changes to bytes?
More information about the Python-Dev