"Marko Rauhamaa" <ma...@pacujo.net> wrote in message news:87egxl4zq8....@elektro.pacujo.net... > Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info>: > >> On Tue, 15 Jul 2014 23:01:25 +0300, Marko Rauhamaa wrote: >>> In fact, I find the lazy use of Unicode strings at least as scary as >>> the lazy use of byte strings, especially since Python 3 sneaks >>> Unicode to the outer interfaces of the program (files, IPC). >> >> I'm not entirely sure I understand what you mean by "lazy use of >> Unicode strings". And I especially don't understand what you mean by >> "sneak". The fact that strings are Unicode is *the* biggest and most >> obvious new feature of Python 3. > > I mean that sys.stdin and sys.stdout should deal with byte strings. I > mean that open(path) should open a file in binary mode. Thankfully, the > subprocess methods exchange bytes by default. > > To me, the main difference between Python 2 and Python 3 is that in the > former, I use "..." everywhere, and in the latter, I use b"..." > everywhere. If I should need advanced text processing features, I'll go > through a decode() and encode(). > >> The Python devs aren't slaves, they get to choose what features they >> work on and which they don't. They don't owe *anybody* any feature >> they don't want to build, or care to support, and that includes >> continuing the 2.x series. > > No need to erect straw men. Of course, the Python gods do whatever they > want. And you asked me to clarify my opinion, which I did. The breakage > of backward compatibility wasn't worth the new features. > > But as I said, what is done is done. We'll live with the reality. >
This sub-thread is the most constructive one I have seen yet that deals with the 'problems' that Python3 has created, and how to deal with them. I take my hat off to Marko for his approach - it has affected him adversely, but it has not prevented him from continuing to develop using Python3. FWIW, here are my thoughts - 1. There were many backward-incompatible changes made in Python3, but the only one that seems to cause problems is the change to the bytes/str types. I agree that it is a big change, but the others seem to have been accepted without argument, so it seems to me that the python devs got an awful lot right. 2. Those adversely affected by the change are very vocal, but we hear very little from those who have benefited from it. This is to be expected - they are just getting on with developing in Python3 and have no need to get involved in controversies. I just tried an experiment in my own project. Ned Batchelder, in his Pragmatic Unicode presentation, http://nedbatchelder.com/text/unipain.html, suggests that you always have some unicode characters in your data, just to ensure that they are handled correctly. He has a tongue-in-cheek example which spells the word PYTHON using various exotic unicode characters. I used this to populate a field in my database, to see if it would display in my browser-based client. The hardest part was getting it in. There are 6 characters, but utf-8 requires 16 bytes to store it - b'\xe2\x84\x99\xc6\xb4\xe2\x98\x82\xe2\x84\x8c\xc3\xb8\xe1\xbc\xa4'.decode('utf-8') However, that was it. Without any changes to my program, it read it from the database and displayed it on the screen. IE8 could only display 2 out of the 6 characters correctly, and Chrome could display 5 out of 6, but that is a separate issue. Python3 handled it perfectly. Would this have been so easy using Python2 - I don't think so. What follows is blatant speculation, but it is quite possible that there are many non-English speakers out there that have had their lives made much easier by the changes to Python3 - a 'silent majority'? I don't mean an absolute majority, as I believe there are still more Python2 users than Python3. But of those who have made the switch from 2 to 3, maybe most of them are quite happy. If so, then the python devs got that right as well. Unfortunately, human nature being what it is, the possibility of this split in the community continuing, to the detriment of Python itself, is all too real. I don't know what more the python devs can do, but there are no guarantees of success :-( Frank Millman -- https://mail.python.org/mailman/listinfo/python-list