Author petri.lehtinen
Recipients cool-RR, ezio.melotti, petri.lehtinen
Date 2011-12-14.09:30:35
SpamBayes Score 1.51015e-11
Marked as misclassified No
Message-id <1323855036.52.0.167594584134.issue13600@psf.upfronthosting.co.za>
In-reply-to
Content
Ram Rachum wrote:
> The `rot_13` codec is supposed to work like this, no?

No it isn't. In Python 3, str.encode() always encodes to bytes and bytes.decode() always decodes to str. IOW, str.encode() encodes text (Unicode) to data (bytes), and bytes.decode() decodes data to text. ROT-13 is not a character encoding, so it cannot be used in this manner.

It's still available in the codecs module, though:

>>> import codecs
>>> codecs.lookup('rot-13').encode('qwerty')
('djregl', 6)

Other text->text and bytes->bytes codecs are also available there.
History
Date User Action Args
2011-12-14 09:30:36petri.lehtinensetrecipients: + petri.lehtinen, ezio.melotti, cool-RR
2011-12-14 09:30:36petri.lehtinensetmessageid: <1323855036.52.0.167594584134.issue13600@psf.upfronthosting.co.za>
2011-12-14 09:30:35petri.lehtinenlinkissue13600 messages
2011-12-14 09:30:35petri.lehtinencreate