A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-February/061190.html below:

[Python-Dev] bytes.from_hex()

[Python-Dev] bytes.from_hex() [Python-Dev] bytes.from_hex()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> name):

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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4