147 points · by zain · 18y ago · 60 comments
"Python 3.0 (a.k.a. "Python 3000" or "Py3k") is a new version of the language that is incompatible with the 2.x line of releases. The language is mostly the same, but many details, especially how built-in objects like dictionaries and strings work, have changed considerably, and a lot of deprecated features have finally been removed. Also, the standard library has been reorganized in a few prominent places."
I have never seen a release for a new language be so clear and straightforward. That's awesome.
http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-1.html
The report gives a defining description of the programming language Scheme. Scheme is a statically scoped and properly tail-recursive dialect of the Lisp programming language invented by Guy Lewis Steele Jr. and Gerald Jay Sussman. It was designed to have an exceptionally clear and simple semantics and few different ways to form expressions. A wide variety of programming paradigms, including functional, imperative, and message passing styles, find convenient expression in Scheme.
Unlike with other languages (which I won't name for fear of offense!) I think Pythonistas will actually migrate to this much improved Python (well, forgetting the 10% performance hit) especially as such focus has been put into making tools to make it easier, unlike with PHP 4->5 (oops..!)
Just for kicks, try getting a stable webapp stack running on 2.6. I'm still not near ready to put that into production (and I run tiny, tiny websites).
There are a whole lot of possibilities for a "webapp stack" in python. What are you running your sites on top of?
My point is not that it's impossible to run 2.6; but setting it up requires a level of sophistication with Python/*nix that I can't put on the shoulders of my organization, yet.
If I were working with a couple of smart hackers, this would be a non-issue. But my feeling is my organization is like a lot of others, where anything that's not a tagged, stable "sudo apt-get install" away is not going to fly.
http://code.google.com/appengine/docs/whatisgoogleappengine....
2.5.2 is "latest stable" for me, I've had no problems with it.
(I think web.py 0.3 and possibly the trunk of Django can handle Py2.6, but obviously they're not going to drop support for older versions any time soon.)
I read over the "What's New" and Guido's announcement, but I didn't find any mention of it.
The net result of the 3.0 generalizations is that Python 3.0 runs the pystone benchmark around 10% slower than Python 2.5. Most likely the biggest cause is the removal of special-casing for small integers. There’s room for improvement, but it will happen after 3.0 is released!
http://docs.python.org/dev/3.0/whatsnew/3.0.html#performance
I'm anticipating a more thorough discussion of this on python-list or python-dev in the near future.
However, be aware that no one in the Python community expects 3.x to be used widely for a few years. Even for new projects, if you want to depend on an existing 3rd party library that hasn't yet been ported, you'll probably have to stick with 2.6.
To accommodate this, they allow you to import almost all of the 3.0 features in 2.6 on a file-by-file basis. So you can pretty much write code in Python 2.6 as if it was 3.0 provided you do the necessary "from __future__ import XXX" at the top of your file to do things like make "print" a function rather than a language keyword, etc. You won't have the reorganized standard library, but for most tasks there's either no difference or minor differences.
So yes, definitely learn Python, but be sure to install both 2.6 and 3.0. I recommend learning with 3.0, but you may have to do "real" projects in 2.6 for some time.
"I'll borrow features from myself in the future!"
[time passes]
"Hey! That guy from the past just copied all my features!"
A) Brand-new programmer or language nomad who wants to dive right into Python. It's for personal enrichment, so they might as well learn the latest dialect and not pick up archaic habits.
B) Wary/professional programmer, or someone who wants to get something else done and thought Python might do the trick. This is the user who will actually bother to stop and read the instructions on the download page, probably because something else they want to use says it requires Python. (Perhaps a library with skimpy documentation.) If it works right away, they'll keep using Python; if not, they'll probably blame Python as a whole instead of the particular version they downloaded and use some other language to solve their problem.
Anyone in charge of a real production system is presumably beyond the "I guess I'll try Python" stage and is able to find out exactly which version they need.
The library is loosely based around the existing threading API, and allows for seamless transfer of Python objects between processes (unlike other forms of IPC).
That's annoying... Even more annoying when I think it's easier to do in Java ;-)
Also serialising 100MB or so worth of objects around is really slow. So the process module is not good for many cases of use.
I think the plusses outweigh the edge cases.
It's going to take ages for modules to get converted over... but most projects have been preparing for it for a while. However hopefully the migration scripts will get better over the 3.0 - 3.1 timeline.
For now I'm sticking with python 2.5 - since it's the best one considering it's far better module, and platform support.
You underestimate the power of the ... wait a sec. :)
Anyway, there's broad support and excitement in the community about this release. I think you'll see modules being updated more quickly than you suspect.
From the release page (http://www.python.org/download/releases/3.0/): This is a production release; we currently support these formats: ...
That said, I also plan to keep my core projects on 2.x for a few more months till django, ipython, debian repos etc. move to 3.x. But I do plan to play with 3.x some.
It's sort of a chicken-and-egg problem because without widespread use of 3.0 no one will feel pressure to upgrade their library. I'm hoping, out of the goodness of their own hearts, that everyone will upgrade their libraries (for no immediate benefit but the gratitude of 3.0 users!). Maybe a website badge should be created for this accomplishment!
Of course, that means making your code work with 2to3 to begin with, but that's a much lower barrier to adoption than outright porting and dual maintenance.