[issue24551] byte conversion

Padmanabhan Tr report at bugs.python.org
Mon Jul 6 13:21:24 CEST 2015


Padmanabhan Tr added the comment:

Dear Mr Steven D'ApranoThanks for your prompt response.I guess that 'b'\x00\x00 0' is the same as b'\x00\x00\x20\x30' if we take (space) as 20 & 0 as 30 as with ASCII / UTF-8 representation.  But if I go by 'Python Library Reference -Release version 3.4.2 (Section 4.4.2) ' there is no room for ASCII / UTF-8 representation here.  Direct byte conversion is used.Please confirm whether I am right.RegardsPadmanabhan

     On Thursday, July 2, 2015 10:20 PM, Steven D'Aprano <report at bugs.python.org> wrote:

Steven D'Aprano added the comment:

I don't know, what *is* the problem? What behaviour did you expect? The code sample you show seems to be working exactly as it is supposed to.

b'\x00\x00 0' is the same as b'\x00\x00\x20\x30', and that is the same as b'\x20\x30' with NUL padding on the left. Written as integers, that is like 0x00002030 == 0x2030 == 8240.

I don't think this demonstrates a bug or problem. If you still believe it does, please re-open the issue with a detailed description of what behaviour you expected and why you think this is a bug.

----------
nosy: +steven.daprano
resolution:  -> not a bug
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24551>
_______________________________________

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24551>
_______________________________________


More information about the Python-bugs-list mailing list