On 14/6/2013 1:14 μμ, Cameron Simpson wrote:
Normally a character in a b'...' item represents the byte value
matching the character's Unicode ordinal value.
The only thing that i didn't understood is this line.
First please tell me what is a byte value
\x1b is a sequence you find inside strings (and "byte" strings, the
b'...' format).
\x1b is a character(ESC) represented in hex format
b'\x1b' is a byte object that represents what?
>>> chr(27).encode('utf-8')
b'\x1b'
>>> b'\x1b'.decode('utf-8')
'\x1b'
After decoding it gives the char ESC in hex format
Shouldn't it result in value 27 which is the ordinal of ESC ?
> No, I mean conceptually, there is no difference between a code-point
> and its ordinal value. They are the same thing.
Why Unicode charset doesn't just contain characters, but instead it
contains a mapping of (characters <--> ordinals) ?
I mean what we do is to encode a character like chr(65).encode('utf-8')
What's the reason of existence of its corresponding ordinal value since
it doesn't get involved into the encoding process?
Thank you very much for taking the time to explain.
--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list