Stephen J. Turnbull
stephen at xemacs.org
Fri Feb 17 07:40:53 CET 2006
>>>>> "Guido" == Guido van Rossum <guido at python.org> writes:
Guido> I'd say there are two "symmetric" API flavors possible (t
Guido> and b are text and bytes objects, respectively, where text
Guido> is a string type, either str or unicode; enc is an encoding
Guido> - b.decode(enc) -> t; t.encode(enc) -> b
-0 When taking a binary file and attaching it to the text of a mail
message using BASE64, the tendency to say you're "encoding the file in
BASE64" is very strong. I just don't see how such usages can be
avoided in discussion, which makes the types of decode and encode hard
to remember, and easy to mistake in some contexts.
Guido> - b = bytes(t, enc); t = text(b, enc)
+1 The coding conversion operation has always felt like a constructor
to me, and in this particular usage that's exactly what it is. I
prefer the nomenclature to reflect that.
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