Re: [Python-Dev] bytes.tohex in Python 3

2008-08-09 Thread Matt Giuca
Hi Guido, Ah yes Martin just pointed this out on the tracker. I think it would still be worthwhile having the tohex method, if not just to counter the obscurity of the binascii.hexlify function (but for other reasons too). Also there's an issue with all the functions in binascii - they return byt

Re: [Python-Dev] bytes.tohex in Python 3

2008-08-09 Thread Guido van Rossum
On Sat, Aug 9, 2008 at 12:40 AM, Matt Giuca <[EMAIL PROTECTED]> wrote: > I'm confused as to how you represent a bytes object in hexadecimal in Python > 3. Of course in Python 2, you use str.encode('hex') to go to hex, and > hexstr.decode('hex') to go from hex. > > In Python 3, they removed "hex" as

Re: [Python-Dev] bytes.tohex in Python 3

2008-08-09 Thread Matt Giuca
Well, whether there's community support for this or not, I thought I'd have a go at implementing this, so I did. I've submitted a feature request + working patch to the bug tracker: http://bugs.python.org/issue3532 Matt PS. I mean ''.join("%02x" % b for b in mybytes)

[Python-Dev] bytes.tohex in Python 3

2008-08-09 Thread Matt Giuca
Hi, I'm confused as to how you represent a bytes object in hexadecimal in Python 3. Of course in Python 2, you use str.encode('hex') to go to hex, and hexstr.decode('hex') to go from hex. In Python 3, they removed "hex" as a codec (which was a good move, I think). Now there's the static method by