Message70932
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:54 | mgiuca | set | recipients: + mgiuca | | 2008-08-09 16:29:54 | mgiuca | set | messageid: <1218299394.34.0.421334599583.issue3532@psf.upfronthosting.co.za> | | 2008-08-09 16:28:46 | mgiuca | link | issue3532 messages | | 2008-08-09 16:28:45 | mgiuca | create | | |