[Python-Dev] bytes.from_hex() [Was: PEP 332 revival in coordination with pep 349?]

Josiah Carlson jcarlson at uci.edu
Fri Feb 17 06:20:30 CET 2006


Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> 
> Josiah Carlson wrote:
> 
> > They may not be encodings of _unicode_ data,
> 
> But if they're not encodings of unicode data, what
> business do they have being available through
> someunicodestring.encode(...)?

I had always presumed that bytes objects are going to be able to be a
source for encode AND decode, like current non-unicode strings are able
to be today.  In that sense, if I have a bytes object which is an
encoding of rot13, hex, uu, etc., or I have a bytes object which I would
like to be in one of those encodings, I should be able to do b.encode(...)
or b.decode(...), given that 'b' is a bytes object.

Are 'encodings' going to become a mechanism to encode and decode
_unicode_ strings, rather than a mechanism to encode and decode _text
and data_ strings?  That would seem like a backwards step to me, as the
email package would need to package their own base-64 encode/decode API
and implementation, and similarly for any other package which uses any
one of the encodings already available.

 - Josiah



More information about the Python-Dev mailing list