[Python-Dev] transform() and untransform() methods, and the codec registry

Alexander Belopolsky alexander.belopolsky at gmail.com
Fri Dec 3 19:28:08 CET 2010

On Fri, Dec 3, 2010 at 4:16 AM, Victor Stinner
<victor.stinner at haypocalc.com> wrote:
> I don't like transform() and untransform() because I think that we should not
> add too much operations to the base types (bytes and str), and they do
> implicit module import. I prefer explicit module import (eg. import binascii;
> binascii.hexlify(b'to hex')).


Implicit imports are currently subtly broken with no solution in sight.  See


In fact, once the language moratorium is over, I will argue that
str.encode() and byte.decode() should deprecate encoding argument and
just do UTF-8 encoding/decoding.  Hopefully by that time most people
will forget that other encodings exist.  (I can dream, right?)  Python
can still provide the codec machinery but not tie it to str/bytes
builtins.  After all, neither encode/decode nor transform/unstransform
fully utilize the power of codec design.

More information about the Python-Dev mailing list