I am new to python and I appreciate the dynamic language. About 30 minutes before my first Python code, I found that the bytes type behaves a little weird (at least):
a = bytes() print type(a) // prints: <type 'str'>
Try it here: http://ideone.com/NqbcHk
Now docs say that strings and bytes behave very similar, except for .format and .encode but I did not expect them to be of the same type. I want to guarantee that I get work with real bytes in my code and that no coercion / encoding / decoding happens.
So what is going on here?
source share