7 ms·
Python, the Web and Little Things on my Mind
- jedsmith 16y agoWell, 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.
- Smerity 16y agoI 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.
- mgw 16y agoI 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.
- fauigerzigerk 16y agoWhat 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.
- Luyt 16y agoI 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.
- fauigerzigerk 16y agoI'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.
- muuh-gnu 16y ago> 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?
- the_mitsuhiko 16y ago> 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.
- jedsmith 16y ago> 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.
- civilian 16y ago>>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?)
- d0mine 16y agoAnd 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.
- cdavid 16y agoI 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.
- SoftwareMaven 16y agoBest 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 http://docs.python.org/library/2to3.html#to3-fixers
- jacobolus 16y agoYou 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)'.
- julian37 16y ago* Read the summary of changes in Python 3: http://docs.python.org/release/3.0.1/whatsnew/3.0.html 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 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-2to3.html 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-pycon-2009 http://www.slideshare.net/regebro/python-3-compatibility-pyc...
- cdavid 16y agoThis 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.
- jackdied 16y agoThe roadmap doesn't need to be modified. The roadmap has always been "the transition will take five years."
- cdavid 16y agoWhere 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).
- Luyt 16y agoThere 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.
- damncabbage 16y agoIn 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.)
- cookiecaper 16y agoPython 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. :)
- mcav 16y agoI'm surprised how many times Mark Pilgrim's quote has been taken out of context.
- jnoller 16y agoSee also: http://news.ycombinator.com/item?id=2131214 http://news.ycombinator.com/item?id=2131214