This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mgiuca
Recipients mgiuca
Date 2008-08-09.16:28:39
SpamBayes Score 0.000139944
Marked as misclassified No
Message-id <>
I haven't been able to find a way to encode a bytes object in
hexadecimal, where in Python 2.x I'd go "str.encode('hex')".

I recommend adding a bytes.tohex() method (in the same vein as the
existing bytes.fromhex class method).

I've attached a patch which adds this method to the bytes and bytearray
classes (in the C code). Also included documentation and test cases.

Style note: The bytesobject.c and bytearrayobject.c files are all over
the place in terms of tabs/spaces. I used tabs in bytesobject and spaces
in bytearrayobject, since those seemed to be the predominant styles in
either file.

Commit log:

Added "tohex" method to bytes and bytearray objects. Also added
documentation and test cases.
Date User Action Args
2008-08-09 16:29:54mgiucasetrecipients: + mgiuca
2008-08-09 16:29:54mgiucasetmessageid: <>
2008-08-09 16:28:46mgiucalinkissue3532 messages
2008-08-09 16:28:45mgiucacreate