On 16-07-18 16:24, 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.
And in what way is the python3 string type part of the problem with that? I don't really understand your point here. You refered to an article where someone seemed to be having trouble because he used a text-interface while he wanted to treat things as bytes and this would somehow show how python3 unicode was trouble some. So I remarked that the problem IMO was using the wrong interface and now you come with a different kind of situation, but I still don't see python3 big string problems being illustrated. > 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( > "latin1") > > versus (Python2): > > AUTH_REQ = "\0{}\0{}".format(USERNAME, PASSWORD).encode("base64") Well this may be somewhat annoying but it hardly seems to illustrate a big problem. -- https://mail.python.org/mailman/listinfo/python-list