[Python-Dev] bytes.from_hex()

Stephen J. Turnbull stephen at xemacs.org
Thu Feb 23 07:21:17 CET 2006


>>>>> "Ron" == Ron Adam <rrr at ronadam.com> writes:

    Ron> Terry Reedy wrote:

    >> I prefer the shorter names and using recode, for instance, for
    >> bytes to bytes.

    Ron> While I prefer constructors with an explicit encode argument,
    Ron> and use a recode() method for 'like to like' coding. 

'Recode' is a great name for the conceptual process, but the methods
are directional.  Also, in internationalization work, "recode"
strongly connotes "encodingA -> original -> encodingB", as in iconv.

I do prefer constructors, as it's generally not a good idea to do
encoding/decoding in-place for human-readable text, since the codecs
are often lossy.

    Ron> Then the whole encode/decode confusion goes away.

Unlikely.  Errors like "A string".encode("base64").encode("base64")
are all too easy to commit in practice.

-- 
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.


More information about the Python-Dev mailing list