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 vstinner
Recipients benjamin.peterson, flox, georg.brandl, lemburg, loewis, vstinner
Date 2010-05-28.13:45:56
SpamBayes Score 0.00053595327
Marked as misclassified No
Message-id <1275054359.5.0.498273872537.issue7475@psf.upfronthosting.co.za>
In-reply-to
Content
I agree with Martin: codecs choosed the wrong direction in Python2, and it's fixed in Python3. The codecs module is related to charsets (encodings), should encode str to bytes, and should decode bytes (or any read buffer) to str.

Eg. rot13 "encodes" str to str.

"base64 bz2 hex zlib ...": use base64, bz2, binascii and zlib modules for that.

The documentation should be fixed (explain how to port code from Python2 to Python3).

It's maybe possible for write some 2to3 fixers for the following examples:

"...".encode("base64") => base64.b64encode("...")
"...".encode("rot13") => do nothing (but display a warning?)
"...".encode("zlib") => zlib.compress("...")
"...".encode("hex") => base64.b16encode("...")
"...".encode("bz2") => bz2.compress("...")

"...".decode("base64") => base64.b64decode("...")
"...".decode("rot13") => do nothing (but display a warning?)
"...".decode("zlib") => zlib.decompress("...")
"...".decode("hex") => base64.b16decode("...")
"...".decode("bz2") => bz2.decompress("...")
History
Date User Action Args
2010-05-28 13:45:59vstinnersetrecipients: + vstinner, lemburg, loewis, georg.brandl, benjamin.peterson, flox
2010-05-28 13:45:59vstinnersetmessageid: <1275054359.5.0.498273872537.issue7475@psf.upfronthosting.co.za>
2010-05-28 13:45:56vstinnerlinkissue7475 messages
2010-05-28 13:45:56vstinnercreate