Benjamin Peterson wrote:
John Machin <sjmachin <at> lexicon.net> writes:On Mar 5, 12:13 pm, Benjamin Peterson <benja...@python.org> wrote:import binascii print binascii.hexlify(some_bytes)AFAICT binascii.hexlify(some_bytes) gives the SAME result as some_bytes.encode("hex") for much more typing -- I see no "better" here.So called encodings like "hex" and "rot13" are abuse of encode() method. encode() should translate between byte strings and unicode, not preform transformations like that. This has been removed in 3.x, so you should use binascii.
Thats actually not what I understand of the encoding/decoding methods (which are very handy, beside the pure charset conversions) that is, they translate between multiple (e.g. 1-n byte strings to a single byte encoding (for encode) and the other way round for decode. Charset mapping is surely the original purpose but I see no reason why all the "pseudo" encodings are bad - since after all they are encodings (base64, hex, ... even gzip) what is missing at the moment would be urlencoding. Cheers Tino
smime.p7s
Description: S/MIME Cryptographic Signature
-- http://mail.python.org/mailman/listinfo/python-list