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/061335.html below:

[Python-Dev] bytes.from_hex()

[Python-Dev] bytes.from_hex() [Python-Dev] bytes.from_hex()Josiah Carlson jcarlson at uci.edu
Sat Feb 18 05:33:16 CET 2006
Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> 
> Stephen J. Turnbull wrote:
> >>>>>>"Guido" == Guido van Rossum <guido at python.org> writes:
> 
> >     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.
> 
> This also has the advantage that it competely
> avoids using the verbs "encode" and "decode"
> and the attendant confusion about which direction
> they go in.
> 
> e.g.
> 
>    s = text(b, "base64")
> 
> makes it obvious that you're going from the
> binary side to the text side of the base64
> conversion.

But you aren't always getting *unicode* text from the decoding of bytes,
and you may be encoding bytes *to* bytes:

    b2 = bytes(b, "base64")
    b3 = bytes(b2, "base64")

Which direction are we going again?

 - Josiah

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