Tuesday, 31 December 2013

About Python 3: A response

This is a response to Alex Gaynor's blog post of similar subject line. I have to say, Alex's information is showing a very strong inherent bias toward Py2-binding. When scripts have minimal dependencies, it's really easy to switch them across, and it's often not hard to make a single codebase that will run on either Py2 or Py3.

On most Linux installations, the 'python' command will run Python 2, and Python 3 has to be called for explicitly with 'python3'. Yes, this may make it look like Py2 is the standard and Py3 is the upstart, and it means that a lot of code that's compatible with both versions will be running under Py2, both of which make it look like we're not using Py3 all that much yet. But that's just skewed stats, not reality. Alex claims that "almost no code is written for Python 3", and while that may be true in his own personal experience, it's definitely not true of the whole world.

Alex then makes two points, which I shall juxtapose. "Why aren't people using Python 3? ... lack of urgency" and "Here's an idea: let's release a Python 2.8". The problem here is that that's the exact attitude that creates the lack of urgency. Here's an alternative idea: Let's NOT release a Python 2.8, so that there really will be no new features in the 2.x line. And let's keep on releasing cool new features in 3.x (how about an async I/O package, support for enumerations, and a library of statistical functions, that's a good start), so there's a strong incentive to switch.

I do understand that it's hard to switch. For someone who's grown up thinking that a character is a byte and that ASCII is all we need, getting your head around Unicode and the need to distinguish what you work with from what you store/transmit does take some effort; but it's something you'd have to do anyway, the only difference is that Py2 lets you defer the distinction until you get a non-ASCII character but Py3 forces you to think about it up-front. Same goes for other changes - the Python 3 way is definitely better, or it wouldn't have been done; if anyone feels strongly enough that a change was wrong, then maybe a "from __past__ import" statement might be implemented. But I'd like to see a solid argument against any of the Py3 changes (I personally disagree with int/int -> float, since float is not a superset of int, but we have int//int -> int so it's just a matter of choosing the operator) - would make a great thread for python-list.

We live in a world, not a series of separate countries. It's high time we had Unicode by default - not "hey, look, this is a Unicode string over here, isn't it special", but "all text is Unicode, and we can also manipulate streams of bytes". Python 3 gives us that. It's high time Python 2 was treated as the legacy interpreter it is - all new code should be written with Py3 in mind. Yes, I understand that some people choose to support older versions of interpreters, for various reasons - I do it myself, in ways that sometimes warp my codebase somewhat - but that should be a conscious choice and not just "here's how to write Python code". Unicode 2.0 was released nearly two decades ago, so it's time to acknowledge that characters aren't bytes, and aren't 16-bit units either. Never mind about "bridg[ing] the gap" between Py2 and Py3 - leave the gap there, and jump over it.

Wednesday, 18 December 2013

Alice in Wonderland book with new illustrations

Regular readers of my blog will be at least faintly aware of my love interest, Alice Liddell. She's a lovely lady, smart and very interesting, and not afraid to take up a Vorpal blade against the Red Queen if the situation demands it. And anyone who's read the books will know the famous John Tenniel art, the iconic images that for many people define Alice.

But what if there were other images illustrating the book? And what if those images were put together into something so beautiful that you cherish it and pass it along to your children or grandchildren? An artist by the name of David Delamere has put together a set of paintings giving a somewhat different take on the art of Alice (though not as different as, say, American McGee's version!), and they're being put together into a book that promises to be something magnificent.

As I write this, there are two weeks to go on their Kickstarter project, from which you could get a copy of the book for $60. Yes, it's not cheap. This is not a basic paperback that you could pick up for $10 at your local bookshop, this is something made by people with a passion for quality. Plus, there's more than just the book in there; as the project has more than its baseline minimum to succeed, the artist and publisher are offering some extras with every copy of the book - check out what's included, as it may well change as time goes on (their $55,000 stretch goal is almost reached!).

It's strange for someone like me to be advocating a dead-tree book. Very strange. Normally I'd do everything electronically if at all possible. Why am I buying this book? Because it promises to be that awesome. Now go! Shoo! Check out that campaign!