>>> b'\542\571\564\545\563', b'\142\171\164\145\163'
(b'bytes', b'bytes')
All the C compilers I know of at the very least generate a warning when one tries to assign an oct literal >= '\400' to a byte. And that's because it's nonsense when bytes have 8 bits, even more so for an 8 bit byte string.
The literal value:
>>> b'\542\571\564\545\563'
should be identical to:
>>> bytes([0o542, 0o571, 0o564, 0o545, 0o563])
That obviously doesn't work:
>>> b'\542\571\564\545\563' == bytes([0o542, 0o571, 0o564, 0o545, 0o563])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: bytes must be in range(0, 256)
This is on Windows/Intel. I haven't looked at the parser in much detail, but I wonder what would happen on a big-endian system?
|