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

Fábio Santos fabiosantosart at gmail.com
Tue Apr 23 07:53:04 CEST 2013


Using decode() and encode() would break that predictability. But someone
suggested the use of transform() and untransform() instead. That would
clarify that the transformation is bytes > bytes and Unicode string >
Unicode string.
On 23 Apr 2013 05:50, "Lennart Regebro" <regebro at gmail.com> wrote:

> On Tue, Apr 23, 2013 at 4:04 AM, Steven D'Aprano <steve at pearwood.info>
> wrote:
> > As others have pointed out in the past, repeatedly, the codec system is
> > completely general and can transform bytes->bytes and text->text just as
> > easily as bytes<->text.
>
> Yes, but the encode()/decode() methods are not, and the fact that you
> now know what goes in and what comes out means that people get much
> fewer Decode/EncodeErrors. Which is a good thing.
>
> //Lennart
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/fabiosantosart%40gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130423/c6b7c7c0/attachment.html>


More information about the Python-Dev mailing list