[Python-3000] base64 - bytes and strings

Terry Reedy tjreedy at udel.edu
Mon Jul 30 05:02:02 CEST 2007


"Greg Ewing" <greg.ewing at canterbury.ac.nz> wrote in message 
news:46AD2BF6.5080507 at canterbury.ac.nz...
| Nick Coghlan wrote:
| > Py3k strings are unicode, so returning a string would mean you just 
have
| > to encode it again using the ascii codec to get the bytes to put on the
| > wire.
|
| I still believe that producing a string is conceptually
| the right thing to do. The point of base64 is to encode
| binary data as text, not binary data as binary data.

On the contrary, to me, the point of base64 is to encode bytes into a 
subset of bytes more or less guaranteed to not get mangled during 
transport.
That these safe bytes correspond to ascii chars (which, yes,is why they are 
safe) does not, to me, make the resulting quasi-random sequence 'text'.

tjr






More information about the Python-3000 mailing list