On Monday 16 July 2018 10:24:28 Marko Rauhamaa wrote: > Antoon Pardon <antoon.par...@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.
>From a lurker, that does sound usefull. The next PEP maybe? > And just look at this: > > AUTH_REQ = base64.b64encode( > ("\0{}\0{}".format(USERNAME, > PASSWORD)).encode("latin1")).decode( "latin1") > > versus (Python2): > > AUTH_REQ = "\0{}\0{}".format(USERNAME, PASSWORD).encode("base64") > > > Marko -- Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene> -- https://mail.python.org/mailman/listinfo/python-list