Padmanabhan Tr added the comment: On Wednesday, July 8, 2015 7:56 PM, padmanabhan T R <trp...@yahoo.com> wrote:
Dear Mr Steven D'ApranoI have not gone through the relevant Source Codes; purely based on my working with Python3 (Version 3.4.2) and the 'The Python Library Reference manual, Release 3.4.2' document, I have the following to suggest as additions to this Manual: - Insert the following under 'codecs.decode(obj [,encoding[,errors]])' - Section 7.2, Page 142 : When a bytes objectis decoded with 'hex' decoding, the corresponding returned array hasASCII characters for byte pairs wherever possible; other byte pairsappear as such. The reverse holds good for encoding. >>> import codecs >>> codecs.encode(b'\x1d\x1e\x1f !"','hex') b'1d1e1f202122' >>> codecs.encode(b'\x1d\x1e\x1f\x20\x21\x22','hex') b'1d1e1f202122' >>> codecs.decode(b'1d1e1f202122','hex') b'\x1d\x1e\x1f !"' >>> codecs.encode(_,'hex') b'1d1e1f202122' >>> codecs.decode(b'3031323334','hex') b'01234' >>> codecs.encode(_,'hex') b'3031323334' >>> codecs.decode(b'797a7b7c7d7e7f8081','hex') b'yz{|}~\x7f\x80\x81' >>> codecs.encode(_,'hex') b'797a7b7c7d7e7f8081' >>> codecs.encode(b'\x79\x7a\x7b\x7c\x7d\7e\x7f\x80\x81','hex') b'797a7b7c7d07657f8081' >>> - Under 'int.to_bytes() - classmethod int.to_bytes()' - Section 4.4.2, Page 31 insert: 'See codecs.decode() also' - Under 'int.to_bytes() - classmethod int.frombytes()' - Section 4.4.2, Page 31 insert: 'See codecs.decode() also' - Under 'classmethod bytes.fromhex(string)' - Section 7.2, Page 142 insert: 'See codecs.decode() also' Padmanabhanm On Wednesday, July 8, 2015 8:57 AM, padmanabhan T R <trp...@yahoo.com> wrote: On Tuesday, July 7, 2015 9:22 PM, Steven D'Aprano <rep...@bugs.python.org> wrote: Steven D'Aprano added the comment: Bytes in Python 3 do use ASCII representation: py> b'\x41' == b'A' # ASCII True If you think the documentation is unclear, please tell us which part of the docs you read (provide a URL) and we will see if it can be improved. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24551> _______________________________________ ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24551> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com