17 points · by twampss · 17y ago · 32 comments
That right there sums up the whole point of Python 3, necessary evil (reverse incompatibility) for future good.
Also, some operations in Python 3, particularly those that are relevant to me as a web application developer, are as fast as 2.6 and in fact significantly faster than 2.5.x.
If for no other reason than the much better support for Unicode - an advantage that will pay off dividends across all products built on 3 in the future - that would be reason enough.
As it is when you look at third party packages that claim to support Unicode you'll frequently find all sorts of cruft that doesn't play well with other packages.
With respect to Unicode and Python, what was once less than intuitive, is now easy. It just works.
Standard ElementTree (pure python) is roughly 40% faster in Python 3 than in 2.5. cElementTree is likewise about 40% faster. A templating package I use runs 3 times slower on 2.5 than on 2.6 and 3.0 (similar performance on 2.6 and 3.0).
Bearing in mind that optimization work will follow on, I believe being "fast enough" is a good achievement for Python 3 and I'm personally pleased that performance will not be a roadblock for my own adoption. Where I can live on the bleeding edge I plan to.
Many thousands of VB programmers (hundreds of thousands?) bridged the gap and a great many work in both versions just like me. It just is not a problem.
Most abandoned Microsoft. Or better said, Microsoft abandoned them. Choosing to release an incompatible set of new languages with no upgrade path was hint enough that Microsoft had purely it's own interests at heart and not that of the lowly VB and ASP developers who made their OS and web server successful. Most took the hint and are now happily supporting Java, Ruby, PHP, Python and Perl web apps (with a side-business supporting VB6 legacy apps and ASP - apparently still alive and kicking after all these years) -in short, anything non-proprietary.
"Fool me once; shame on you. Fool me twice; shame on me." For Microsoft, no second chance.
The problem was that VB.NET was a completely different language from VB6, with the full consequences therof: no upgrade path for existing code, retraining of all personnel, etc.
On IIS the upgrade to ASP.NET required purchase of a new IDE (Visual Studio) for all developers and retraining of all personnel, (ASP required no IDE). And ASP.NET abandoned support of VBScript which was by far the most popular ASP language.
That might well explain the unwillingness of so many to move over even after .NET started to deliver the goods (from version 1.1)
His worst argument: a comment that claims he's worried that Py3k will get security fixes that Python 2.6 won't --- a borderline-irresponsible cheap shot.
It's too bad, because I actually agree with his assessment; I get a whiff of "second-system syndrome" from this whole Py3k project, and the idea of breaking random bits of code in an interpreted, dynamically typed language and then fixing them with a code translator seems like lunacy.
Mainly, I see this release as cleaning up the warts that python had accumulated. {imap, ifilter, izip, iterkeys, itervalues, iteritems, xrange} all becoming default and their non-stream counterparts ceasing to exist is a huge upgrade.
Unifying new-style and old-style classes is a huge cleanup and upgrade. (Which simplifies code for newbies quite a bit, too).
The move to default unicode strings is a huge upgrade.
The library cleanup is a huge upgrade.
The inclusion of multiprocessing (actually 2.6, but who uses that?) is a huge upgrade.
I don't see any of this as "breaking random bits of code", but rather as stepping back to regroup the language into a much more coherent whole.
But then, I'm in the tank for python, I freely admit.
Many millions of lines of Python code work in the field right now; a decent subset uses Unicode (for instance, most Win32 Python code has to). I buy that the new Unicode model is better, but I don't buy that it's so much better that a code port is worth it.
The library cleanup is a major win, but they could have done that in Python 2.7.
It's hard to say multiprocessing is a huge win in 3.0, since it's already in 2.x.
Yeah, I was just joking about that bit.
I don't see why it would be any different for the 2.7 library have been reorganized than it is for the 3.0 library reorganization; it would have broken just as much code. And while you're breaking code, you should break the code that needs to be broken, right?
And it's not just unicode, it's unicode/new style classes/iterators throughout (which I think is an underrated change). None of these could have happened without breakage, and I think it's better to clear the decks once every 15 years than it is to just grow by accretion forever.
Those lines of python in the field that work are not going to stop working; python 2.x is not going to go away or go unmaintained, as you point out yourself. Writing new code will shortly become more difficult in the 2.x series, as libraries start switching to 3, but the old code will be maintainable for a long while.
In order for the language to keep growing in a clean, pythonic fashion, it needed to be cleaned up a bit, and I think they did a great job of it.
As for python 3.0 being 10% slower than 2.5 - that means that it is is just 1.9 times faster than Ruby instead of a clean 2x? And the backwards incompatible version took just two years instead of infinity like Perl and two years instead of the UNK for Ruby? Python 2.5 benefited from a corporate sponsored "Need For Speed" sprint where twenty of the core devs went on a paid vacation with a mission to just sprint on speed issues. There hasn't been a corresponding sponsored event for 3.0.
A huge amount of volunteer time has been spent on backwards compatibility issues. When the Python 3.0 issue was first floated the Twisted and Django folks had lots of worries about the transition and supporting two versions (2.x and 3.x). Hundreds of hours were spent on the email lists and PyCon dinners hashing out the details. Thousands of hours were spent adding warnings and best practices docs to 2.6 as well as on the "2to3" translation tool.
Time will tell but there will certainly be lessons learned from the Python 3 release.
Bitching about py3k is basically whining about being forced to learn new things.
The one question I have is are people going to start using different filename conventions?
I could see temporarily associating .py3 with a /usr/local/bin/py3k for testing purposes and porting 2.6 to 3, but I really hope it doesn't become a widespread practice.
Me, I'm going to yum up those dictionary comprehensions and that OCaml-style pattern matching as soon as I can. Tasty!
But it depends upon how you manage your code - whether it's just a few loose scripts, part of a larger project, a web app or a desktop app or a command-line script, or what your deployment and install processes looks like, etc. etc. I usually install my Python scripts with Buildout these days, so I let Buildout autogenerate the shebangs to point to the required Python installation.
I could live with *.py3 for a few years (remember php3?) but it's kind of a wart. And the thing I like about python is the core teams assiduous avoidance of warts.
The Ruby comparison Jens makes is exceedingly disingenuous; Ruby 1.9 is a runtime upgrade, not a major language update. Improving performance is mostly the point of it. And even then, there are areas of Ruby that remain controversial, like the threading model.
> 3.0 is 10% slower because of the change from ints to longs. If you read it carefully, they mention that there is space for improvement, but they want to have it out so people can start to use and see the differences. Release early, release often (and it took 3 years to get there, so better do this once and for all.)