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

Guido van Rossum guido at python.org
Tue Apr 23 17:47:34 CEST 2013


On Tue, Apr 23, 2013 at 8:22 AM, M.-A. Lemburg <mal at egenix.com> wrote:

Just as reminder: we have the general purpose encode()/decode() functions in the codecs module:

import codecs r13 = codecs.encode('hello world', 'rot-13') These interface directly to the codec interfaces, without enforcing type restrictions. The codec defines the supported input and output types.

As an implementation mechanism I see nothing wrong with this. I hope the codecs module lets you introspect the input and output types of a codec given by name?

-- --Guido van Rossum (python.org/~guido)



More information about the Python-Dev mailing list