[SUSPICIOUS MESSAGE] Re: Cult-like behaviour [was Re: Kindness]

Marko Rauhamaa marko at pacujo.net
Mon Jul 16 10:24:28 EDT 2018

Antoon Pardon <antoon.pardon at vub.be>:

> I really don't understand why the author of that article didn't just
> copy his python2 program but used sys.stdin.buffer and
> sys.sydout.buffer instead of plain sys.stdin and stdout.

Yes, it would be nice if you could simply restrict yourself to bytes
everywhere when your application needed it. Unfortunately, quite many
facilities demand text, and you will need to ponder carefully at each
such place how you deal with encoding/decoding exceptions.

Plus the bytes syntax is really ugly. I wish Python3 had reserved '...'
for byte strings and "..." for UTF-32 strings.

And just look at this:

   AUTH_REQ = base64.b64encode(
       ("\0{}\0{}".format(USERNAME, PASSWORD)).encode("latin1")).decode(

versus (Python2):

   AUTH_REQ = "\0{}\0{}".format(USERNAME, PASSWORD).encode("base64")


More information about the Python-list mailing list