[Python-Dev] Why can't I encode/decode base64 without importing a module?
victor.stinner at gmail.com
Mon Apr 22 13:38:47 CEST 2013
Your question is discussed since 4 years in the following issue:
The last proposition is to add transform() and untransform() methods
to bytes and str types. But nobody implemented the idea. If I remember
correctly, the missing point is how to define which types are
supported by a codec (ex: only bytes for bz2 codec, bytes and str for
2013/4/22 Ram Rachum <ram at rachum.com>:
> Hi everyone,
> Take a look at this question:
> Is there really no way to use base64 that's as short as:
> Because doing this:
> import codecs
> codecs.decode(b"whatever", "base64_codec")
> Or this:
> import base64
> encoded = base64.b64encode(b'whatever')
> Is cumbersome!
> Why can't I do something like b'whatever'.encode('base64')? Or maybe using a
> different method than `encode`?
> Python-Dev mailing list
> Python-Dev at python.org
More information about the Python-Dev