[Python-Dev] bytes.from_hex()

Stephen J. Turnbull stephen at xemacs.org
Sun Feb 19 17:21:59 CET 2006

>>>>> "Josiah" == Josiah Carlson <jcarlson at uci.edu> writes:

    Josiah> The question remains: is str.decode() returning a string
    Josiah> or unicode depending on the argument passed, when the
    Josiah> argument quite literally names the codec involved,
    Josiah> difficult to understand?  I don't believe so; am I the
    Josiah> only one?

Do you do any of the user education *about codec use* that you
recommend?  The people I try to teach about coding invariably find it
difficult to understand.  The problem is that the near-universal
intuition is that for "human-usable text" is pretty much anything *but
Unicode* will do.  This is a really hard block to get them past.
There is very good reason why Unicode is plain text ("original" in
MAL's terms) and everything else is encoded ("derived"), but students
new to the concept often take a while to "get" it.

Maybe it's just me, but whether it's the teacher or the students, I am
*not* excited about the education route.  Martin's simple rule *is*
simple, and the exceptions for using a "nonexistent" method mean I
don't have to reinforce---the students will be able to teach each
other.  The exceptions also directly help reinforce the notion that
text == Unicode.

I grant the point that .decode('base64') is useful, but I also believe
that "education" is a lot more easily said than done in this case.

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