[Python-Dev] bytes.from_hex()

Stephen J. Turnbull stephen at xemacs.org
Sun Feb 19 14:30:54 CET 2006


>>>>> "M" == "M.-A. Lemburg" <mal at egenix.com> writes:

    M> Martin v. Löwis wrote:

    >> No. The reason to ban string.decode and bytes.encode is that it
    >> confuses users.

    M> Instead of starting to ban everything that can potentially
    M> confuse a few users, we should educate those users and tell
    M> them what these methods mean and how they should be used.

ISTM it's neither "potential" nor "a few".

As Aahz pointed out, for the common use of text I/O it requires only a
single clue ("Unicode is The One True Plain Text, everything else must
be decoded to Unicode before use.") and you don't need any "education"
about "how to use" codecs under Martin's restrictions; you just need
to know which ones to use.

This is not a benefit to be given up lightly.

Would it be reasonable to put those restrictions in the codecs?  Ie,
so that bytes().encode('gzip') is allowed for the "generic" codec
'gzip', but bytes().encode('utf-8') is an error for the "charset"
codec 'utf-8'?

-- 
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