Hacker News new | past | comments | ask | show | jobs | submit login
Python, the Web and Little Things on my Mind (pocoo.org)
112 points by mattyb on Jan 22, 2011 | hide | past | favorite | 33 comments



Well, that seals the deal. Bummer.

I really hoped Armin would come around, and I committed to Werkzeug for a new project with eyes on 3. This was a direct result of the PEP 3333 acceptance, and I apparently backed the wrong horse.

The worst part of this whole thing is that it is getting harder to explain working in Python to my other-language friends. Well there's 3, and yeah it's at 3.2, but don't use it. Nobody uses 3. Maybe distribute. Maybe setuptools. I'm not sure.

As a non-participating, quiet consumer of Python, I am very confused about the future of my chosen language. I think it is intermediate, perhaps career-minded (internal) users of Python like myself that are confused the most.

Edit: On reflection, I was encouraged to see what I perceived to be frustration on the part of GvR (in the acceptance thread for 3333 on Web-SIG), so here's hoping this will be a good year.


> I really hoped Armin would come around, and I committed to Werkzeug for a new project with eyes on 3.

All commits to Werkzeug are currently happening with a port to Python 3 in mind. However I am not going to do the same mistake the standard library made in many parts and change the semantics of the library for Python 3 and trusting 2to3 to do the correct thing.

A full port of Werkzeug to Python 3 will take time but it will happen eventually. The point here is that everybody should go with Python 2.7 and write the code forwards compatible. Then you have all the options (of going with PyPy if you need and upgrading to Python 3 if it's worth the effort).

All I can say right now is that so far users are not too eager with Python 3 yet and I have limited resources as well. If anyone wants to help out, I am more than happy to assist in any way possible to make Werkzeug run on Python 3. I also monitor changes in the stdlib that could affect WSGI on Python 3, so it's not that I'm ignoring it.

Python is not on the way to suicide. All I said was that right now you shouldn't be too concerned with Python 3 yet and instead make your own code upwards compatible. If your base Python version is 2.7 upgrading will not be the biggest problem, especially not if you are working on a high level like you do when you use a web framework.


> I have limited resources as well

I'd like to make clear that I wasn't bitching, because I know exactly how the limited resources dance goes. Disappointment with further confusion between Python 2 and 3, yes; disappointment with you, no (are you kidding? half my stack is Pocoo stuff).

> All I said was that right now you shouldn't be too concerned with Python 3 yet

The real question is when "yet" will be. Python 3's been out two years, and I don't think I'm alone in the community in wondering if it'll ever be completely figured out. The fact that PEP 3333 was just accepted is a testament to the slow nature of the thing.

It's getting tiring to want to use 3 but instead having to stick with 2to3. Even that is a distant goal: when will I be able to finally run 2to3 and move entirely to 3? If I'm entrenched in a lot of Python 2 libraries, I'm beginning to believe (two years later) that the big day will never come.

Python 3 is great. I want to use it. It's fights like Web3 vs. WSGI and the resistance to (or impossibility of) porting the libraries I use that are personally keeping me away from it. I think that speaks for the lack of eagerness to move to 3 that you've observed. It's very real, and entirely, I think, due to libraries.

I'll be at PyCon as well on behalf of my employer, and I'm interested (as it sounds like you are, from your blog post) to hear what the consensus is on Python's future. Right now, I have a lot of questions, and nobody seems to have answers.


We have had answers for the past two years: Python 3 adoption will be measured in terms of years and will only come as third party modules (such as Numpy, Scipy, and many others) slowly make the port.

No one has ever claimed it to be publicly ready for product, but more and more libraries are porting every single day - forward progress is being made, but like all change in the community, it takes time.

I'm a core developer: and even I stick to python 2 right now because of my dependencies. I know full well that me being able to run Python 3 in production is at least another year, to two years off.


That's what I've been told for the last two years -- it'll come, give it time, etc. Then the developer of a library I use announces that a port to Python 3 is unlikely two years after Python 3 is released, and I'm left with even more questions.

I'm curious since you continue to advise patience how you'd react in my position. I've been patient, and now my library of choice for WSGI coming to Python 3 is, quote, "unlikely". What now? Why should I bother caring about 3, if an influential voice in the Python community doesn't? Armin makes excellent points in his post, to be frank.

The fault line is widening, honestly, because of the lack of forward momentum. Your estimate of Python 3 in production being a year to two years off sounds like it come completely out of thin air, as I'm starting to wonder if it will ever happen.


Most Python libraries are considering and/or starting a port now. Py3 is just now starting to be taken seriously, which is fine by me; we don't need to rush to use the "latest cool thing" as long as we get there eventually. It's good for Py3 to be tested and developed without being flooded for its initial lifecycle, which is what happens here.

Note that this attitude has mostly been guided by the Python Foundation in the first place. Until a few months ago, Python 2 was still actively developed. It has entered maintenance mode with 2.7; all future features or enhancements now go to Py3.

Again, please note that 2.7 was released only about six months ago. Since then, libraries, distributions, and other major players that push normal users to adopt new stuff have been moving to Python 3. As popular low-level libraries make the move higher-level stuff will begin to consider it too; Django's reason for not porting to Python 3 is basically "none of our dependencies run there yet".

This post actually demonstrates the strength of Python 3; while the author doesn't feel that this library specifically is a good candidate for a port, he is thinking about it, and he recommends that users still prepare for the transition. He says, in effect, "write code so that 2to3 can handle it easily when the moment comes", not "give up on Python 3 entirely".


Brett and I were just discussing this - and he put up a post summing it up nicely: http://sayspy.blogspot.com/2011/01/my-semi-regular-reminder-...

Short version? We planned on it taking at least 5 years. Armin's point is that Python 3 isn't "there yet" in terms of demand an adoption. Python 3.2 (which increases performances, and fixes bugs) is just coming out. Armin's point - backed by his comments here, is just that demand isn't high enough for him to dedicate the resources to port.

On the other hand, earlier today he was committing bug fixes to the Python 3 source tree, so there's obvious forward movement.


That's a good post, and I'm glad Brett took the time to share his thoughts. Characterizing me personally as a naysayer is missing my point entirely. Throughout this whole thread, I've mentioned that I have questions. The closest I got to naysaying was a rhetorical "why should I care about 3?". Perhaps that's frustration of others boiling over into his response, but given that my comments were really the catalyst for the post (presumably), I was surprised to read it that way.

Brett, Armin, you, Guido, and the rest of the "in" Python developers expected a long turnaround. I understand that now. Brett touched on something, though: that 5-year estimate was on python-dev. That internal discussion does not percolate up to the rest of us that use Python daily but only lightly pay attention to the development ins and outs. I have learned a valuable lesson from this entire thing, which is that I need to pay attention to all of my tools.

How many end users does Brett expect to read python-dev?

You have to look at this from the perspective of a casual user, or perhaps even a user just getting started with Python today.

People always rush to the newest version, and the "Python 2 or 3?" link on python.org is all the way at the bottom, below even Merchandise. (It should be above the download links, in my opinion.) http://www.python.org/download/ also attempts to very lightly dissuade the user from getting 3:

> they're both considered stable production releases.

> If you don't know which version to use, start with Python 2.7

Those are both true statements, but one can be read as going against the other. Assuming they miss that -- which can be easily blamed on the user, I guess -- new users end up playing around with the Python tutorial in IDLE under Python 3. Maybe a few scripts and adoption of Python 3 specific idioms. Then a friend mentions Django, but wait ... Django doesn't have Python 3 support yet. Now they're confused. What now? Oh, they have to use Python 2 instead, but a lot of code that they've written so far doesn't work under Python 2.

In my very humble opinion, I believe this is a poor time to get started with Python. This transition is hurting new adoption, and there is an incentive to get it finished as quickly as possible. What I don't gather from library developers is a sense of urgency to fix it, and my evidence to that end would probably be the acceptance of PEP 3333 taking ages among other disagreements. The immediate response that I anticipate is well, we don't have the resources, but what I gather from other Python developers like me is that this confusion is hurting more than helping.

I'm honestly not sure how I would have done this differently, and I don't claim to have enough wisdom to even know where I'd begin. My initial question would be, if Python 3 had a 5-year outlook for libraries being ready, why wasn't it stabilized and kept in development for, say, 4 of those years? Was the general release necessary in order to port libraries and get distributions on board with packaging? I understand which I should pick because I have Python experience. A flood of new users probably do not, and comments elsewhere in this thread (such as the suicide one) just demonstrate even more confusion about the entire thing.

Obviously, I fully realize that it's unfair to hold a language back because the libraries need a transition period. However, Python without a library (particularly for Web development) only gets you so far, and the burden is on the library authors now.

I guess the underlying thought is that if Python 3 is given first-class treatment on the python.org brochure, an uninformed user might expect that a choice between the two is unnecessary. That there is a choice that must be made just serves to confuse and alienate users.

My two cents, and I'm probably off base anyway.


Since you took the time to write such a big reply - I owe you the same courtesy. First: I'm not referring to you as a naysayer, just trying to clarify the timeline (both expected and perceived). No - your comments were far from the single catalyst for his post, months of comments built up to that comment, so don't worry - none of this, or that, was a personal attack against you.

I concur - the http://wiki.python.org/moin/Python2orPython3 page needs to be more prominent. I think the entire download page needs to be junked, and completely rethought out, but I, not anyone else I know have the time or the constitution to do it.

So yes, the download page could be better - but I don't know anyone willing to change it.

How would you communicate it? Python-dev is public, the plans and designs of Python 3 are open. The lists are open for questions, and I don't know of a single core developer who would not take the time to answer questions. We've made it as public as possible, and reiterated it at every single PyCon, in every blog post we could, etc.

I completely disagree that this is a poor time to get started with python. There is no confusion: Use Python 2 unless you can use Python 3. I use python2 every day, and have no intention of switching to 3 in production before Django and several other things port over.

The python community (see PEPs, the moratorium, web-sig discussions) moves relatively slowly. We get something that works and then we slowly begin to move towards something else. A lot of discussion, and a lot of thought goes into each step.

For example, yes: the general release was necessary - we need an official release for people to even pay attention. We need an official release for OS distributions to even consider picking it up and shipping it alongside existing Python 2 installs.

Yes, the fact that a choice has to be made sucks: but we, those of us in "core" can do nothing but encourage and help with porting where we can, the PSF can sponsor sprints, and we can bide our time.

As for the length of time to get PEP 3333 accepted? Go look at the web-sig archives to find out way. No decision in the community is made without intense and thorough debate.

Finally, I can understand your frustration - its frustrating I have to keep repeating myself because this confusion exists. But I can sum my opinion really simply: Use Python 2.7 until more libraries and frameworks port.

Everyone is open to how we can improve communication: but we're also short on resources. I do what I can commenting in places like here, and trying to explain to people who don't know.

So, I hope that this "confusion" isn't hurting adoption: we've tried to explain things time and time again, only time and framework/tool and libraries authors porting can help at this point.


I must say I have a great deal of respect for Armin and thought he represents a good viewpoint. The convergence of some of Python's web frameworks is great and the fact that WSGI has become such a central specification is great.

In relation to Werkzeug and Python 3 you'd have to ask Armin himself but I think he said merely that a direct port of Werkzeug isn't likely possible as opposed to Werkzeug will never be ported to Python 3. Werkzeug is lower level and likely can't be ported directly due to a number of the differences between Python 2 and 3.

As he points out higher level libraries like Flask stand a far greater chance of surviving direct ports from Python 2 to 3.


What I find so odd about this whole Python 3 situation is how completely accepting the Python community has been in the face of what amounts to programming language suicide. How on earth is it possible that none of the web framework authors decides to break with the past and just ports to 3 regardless of any incompatibilities? Why is an antiquated web server interface like WSGI more important than the whole of Python? Why are the popular postgres adapters and many other libraries not ported to 3? I just don't get it.

Of course all these people work for free so no one can tell them what to do. But I'm honestly baffled. If I work for free over years and years, supporting a programming language I like, I don't let it die like that.

I have looked into some of these unicode issues myself and I have a general idea about what the technical porting issues are. It's not rocket science. It must be something completely non technical that's going on here and I don't understand it.

It's infuriating for me to see that happen to a language I have been using on and off almost since its inception.


I wouldn't call it 'programming language suicide'. Are developers who are working on Perl 6 intent on killing Perl 5? When generics were added to Java, was that done to eliminate the Java language?

Nah, people are just progressing. Over time, certain deficiencies are recognized in programming languages, and they get repaired. In the case of Java, generics were sorely missed, so they got added. In the case of Python 3, unicode support will be much better streamlined, and standard libraries get a bit restructured; some names are cleaned up. It's not like half the language changes. Not even 2%, is my guess.


I'm not calling the changes in Python 3 suicide but rather the fact that so many library/framework writers do not update their code to support Python 3. This is killing Python's momentum in my view.


A couple of months ago I decided to use Python for my (undergraduate) dissertation project. I assumed that the newest version of the language is the one to go with. And everything was fine until a few days ago when I discovered finding a library to draw simple graphs that is compatible with Python 3 requires quite an effort.

Now I have to either take everything back to 2.7 or keep believing that I will finally manage to work it out with 3.

How is that going to kill the "momentum" I received and change my feelings about Python? It's not going to change them. I enjoyed every single moment of coding so far, even those very first ones where I kept inserting curly brackets everywhere. So, if it fits my needs, I am going to use it in future projects as well.

How is that going to change the industry's feelings about Python? Who knows? But I doubt the industry worries about "momentum". If you are using 2.7, keep using it until Python 3 is usable for your. If you are not using Python yet but you want to, do your research beforehand (something I falsely didn't do) and decide what's best.

Now, how long is it going to take for the major libraries/frameworks to be Python 3 compatible, nobody can tell. And it's funny as we are approaching the "3.2" version already.

But, honestly, who cares? Is a number more important than the language itself?


> This is killing Python's momentum in my view.

It is not the job of application developers to keep up a languages "momentum", its the language creator's job. If he underestimated the momentum of the current version and didnt bother to inter-coordinate incompatible language upgrades with his users and introduced a new trademark-diluting version anyway, you cant simply blame the users for not investing time and money in order to "protect the language". They are not obliged to follow whereever he leads, and if he wants to lead without caring about his followers, they might just decide not to follow any more. Who guarantees that he's not going to pull a Python3 again 5 years down the road and then sing the same "not updating is momentum killing" song again?


I think it's pretty unfair to call this situation Guido's fault. Python 3 was developed with a significant amount of feedback from the community, and it was in development for years before being released. At multiple points in the process, Guido listened to feedback and conceded; one instance that comes to mind is Guido wanting to drop lambda, map(), and filter().


No one is obliged to do anything, least of all application developers, and I wasn't talking about them at all. I was wondering about the motivation of library and framework maintainers. It wasn't my perception that the process leading up to Python 3 was anything like the kind of language creator ego trip you describe. It was a longish collective process and it has since been made very clear that further language changes are not in the cards any time soon.


What if, in your statement, you've unwittingly come across the answer? Why wait for Python 2 libraries to port ... maybe there's a hole in the market here for Python 3 libraries to outright replace the Python 2 ones?

It sucks, yes, but it'll move Python 3 forward...


I fully agree with this sentiment. This whole discussion about 3 or 2, which isn't really one for Python developers involved in the community, is hurting mainstream adoption the most. People don't like to learn a new language, when they're not sure which the future proof way to start is and when the project behind it seems to be 'in limbo'. I hope this doesn't hinder the Python project too much.


>>So let me reiterate my suggestion for Python 3 in web applications: don't use it just yet, but write your code in a way that it could pass through 2to3.

Is there a good article for summarizing how I write Python2 code that is compatible Python3? I mean, what things do I avoid in Python2 to write good Python3 code? (And while I'm asking dumb questions: how do I make blocks of text italic on HN?)


* Read the summary of changes in Python 3: http://docs.python.org/release/3.0.1/whatsnew/3.0.html

* See Guido Rossum's Transitional Development notes here: http://www.artima.com/weblogs/viewpost.jsp?thread=208549

* Read Mark Pilgrim's excellent chapter from Dive into Python 3: http://diveintopython3.org/porting-code-to-python-3-with-2to...

* Use Python 2.7 and turn on deprecation warnings.

EDIT: Found this great guide to forward compatibility:

* http://www.slideshare.net/regebro/python-3-compatibility-pyc...


Best resource I know if is to look at what the 2to3 tool does and try to minimize those items. Many items it fixes are possible to do correctly in 2.6+ (e.g. print(x) instead of print x, even if print still doesn't evaluate as an expression in 2.x).

http://docs.python.org/library/2to3.html#to3-fixers


You can use:

  from __future__ import print_function
And then print() should work as expected in Python 2.6+. That is, print(1, 2, 3) will print '1 2 3' instead of '(1, 2, 3)'.


And while I'm asking dumb questions: how do I make blocks of text italic on HN?

Use *

There is a help link in the right-bottom corner of the text field if you press edit.


I am not aware of such resource, but the best thing to do IMO is to simply include 2t3 and running your test suite on both 2.x and 3.x code from day one.


There seems to be a obsession with version numbers: People perceive these as if they must always have the latest/greatest. For example, when MSSQL 2008 came out, the database admin at a company I work for upgraded the MSSQL 2005 database to it, breaking a few applications due to incompatibilities. Version 2008 offered no features we were planning to use, so from an operational standpoint it was completely unnecessary. But it was motivated just because of the higher version number.

The same with Python2 and Python3. Python3 just exists out there so library developers can port their code over to it. It isn't meant to be used in production yet, and people learning Python are advised to learn Python2, not 3. Yet time and time again people choose version 3 to begin with 'because it must be better since it's 3 and everyone knows 3 is better than 2' (the most often heard reason on the #python IRC channel), thereby making it more difficult for themselves than necessary.


Python 3 is much more than a version number increment. Newbies are advised to use Py2 only because there are more libraries available for 2, and newbies are more likely to need more libraries. This is changing slowly but surely as more libraries go to 3.

2.7 is the last major release in the Py2 line. It's all Py3 from here on out, so people are starting to take Py3 seriously, as they rightly should. Python 3 is now the default distribution in Arch Linux and other bleeding-edge distros will be following soon. I'm kind of disappointed the major shift didn't start happening earlier, though the long cycle was to be expected.

"Stable" and "production-ready" Python 3 releases have been out for about two years now, by the way, so this definitely isn't a case of everyone jumping over just for a higher version number, and Python 3 has been "battle tested" for a while. I'm sure as the real heavyweights like Scipy start seeing real Py3 usage, cpython3 will get a lot of fixes and improvements.

We're just starting to hit "conversion critical mass" where everyone is beginning to see it's important to upgrade Py3 soon. I would guess in the next year most major projects will have ports underway if not completed, so the Python world will be undergoing a major transition this year, which may complicate things for a while but is for the long-term good of the community. :)


In my case, it's more that, when I learn a new language, I don't want to end up learning something that's going to turn into the next PHP 4 in a year or two.

(That is: still used, has lots of libraries written with it, technically more or less future-compatible, but is the thing everyone is moving away from.)


This is a good article, of interest to people even outside web dev in the python community. I did not know that python 3.1 was that much slower than python 2.x (python 3.0 was, but this was well known from everyone).

His point about writing new python 2 code for easy 2to3 application is a good one: porting existing projects to python 3 is quite difficult, because it cannot always be done without breaking API, but writing new code which can be easily ported is much easier. There still needs better support to easily use 2to3 and test its output in an automated fashion.

I am also delighted to see known python hackers to recognize the lack of python 3 usage, and that maybe the roadmap needs to be somehow modified.


The roadmap doesn't need to be modified. The roadmap has always been "the transition will take five years."


Where are you taking this five years number ?

The roadmap has already changed, BTW. At some point, the plan was to have python 2.x such as to convert so that python 2.x will be very close to python 3, plan which was abandoned AFAIK (I can certainly understand why, though, since it would have required a lot of non-fun work).


I'm surprised how many times Mark Pilgrim's quote has been taken out of context.





Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: