[Python-Dev] Why can't I encode/decode base64 without importing a module?

Barry Warsaw barry at python.org
Tue Apr 23 17:15:23 CEST 2013


On Apr 22, 2013, at 06:22 PM, Guido van Rossum wrote:

>> You can ask the same question about all the other codecs.  (And that
>> question has indeed been asked in the past.)
>
>Except for rot13. :-)

The fact that you can do this instead *is* a bit odd. ;)

from codecs import getencoder
encoder = getencoder('rot-13')
r13 = encoder('hello world')[0]

-Barry


More information about the Python-Dev mailing list