Hacker News new | ask | show | jobs
by vph 5004 days ago
There are two significant factions in the Python community: the scientific group and the web-dev group. The scientific group is pretty much on board with Python 3. Perhaps due to unicode handling intricacies, that the web-dev group ain't exactly on board with Python 3 yet. But this needs to change and it takes leadership. Fortunately, bit and pieces such as webob are Python 3 compatible. And personally, I feel the Python web frameworks need a fresh redesign.
8 comments

I work in both camps, and I always felt it was the web developers that were better about moving on to 3. Scientists in general are loathe to risk breaking well-tested code for the sake of new features. In my research group, in fact, we've just barely moved on to 2.7 from 2.4! I doubt there will be any motivation at all for moving to 3 any time soon.
I doubt that web developers are better about it, my reasoning follows:

The #1 Python web framework, Django, is a bit ahead of the curve but still hasn't released a major version that supports 3. Django's huge ecosystem of addons are not going to catch up for some time after that. And users are not going to develop green-field Django apps on Python 3 until some time after that. So the timeline for serious use of Python 3 with Django should still be counted in years, which means that the majority of Python web development will not be done with Python 3 for a while. (If Flask and Werkzeug had been out ahead of this issue, it could have eaten up even more of Django's market share, but it looks like it will actually be behind in adopting Python 3). I don't think any of the Zope frameworks or ZODB, etc. support 3. And I think between those three you probably have most of Python web development accounted for.

Pyramid, Bottle, Tornado and CherryPy DO support Python 3 but aren't nearly as widely used. App Engine needs a new runtime and that could be years. I don't think that Web2py or web.py have released versions which support Python 3, though both probably have something in the works.

Since web development is so heavily framework-driven, the majority of web development on Python is not going to move on to 3 until Django and Flask ecosystems move over, or everyone switches to Pyramid.

And due to the requirement for backward compatibility, Python 3 features will not be widely used for a while (suppose you make a widely used extension, you are not going to lock out people using 2.7, this means you are using the common denominator of features and supplying Python 2 implementations for the stuff you are using from new Python 3 libraries).

I would contrast this with the very large number of general Python libraries which already support Python 3. So I think the Python web development world is well behind the rest of the Python world.

It's a mess but I think that Python 3's improvements are worth not straitjacketing the future of the language into the decisions made in 2.

At KyivPy#8 I heard about new lightweight framework supporting Python3 - wheezy.web. But as you said it is not a mainstream among web-developers.

I think the most popular Django apps will move to Python 3 as a lot of people are interested in it. Time show us how Django with Python3 support will change the current situation.

Research software typically have a very small user base and can quickly become out-of-date, so there's no great incentives for current software packages to upgrade. But I'm talking about the developer community of scientific Python, not the user community. The developer community includes such things as numpy, scipy, matplotlib, etc. are pretty much Python 3 compatible. This makes it easy for new scientific projects to jump on board with Python 3.
Yeah, a lot of research software in academia is written by grad students with no formal CS education who're just interested in completing their dissertation and graduating. After they've graduated and left, the codebase just languishes until the next grad student comes along, who spends a couple months trying to figure out all the spaghetti code and ridiculous hacks used by the previous student to complete their thesis in the fastest time possible. After this process repeats itself 3 or 4 times, the codebase is pretty much useless and has to be thrown out.
> a lot of research software in academia is written by grad students with no formal CS education

Are you sure? Because that sounds like an complete oxymoron. You probably may have meant something else. Would you like to clarify on why grad students lack formal CS education?

Yes, I'm sure. I'm referring to scientific software - that is, software written in fields such as biology, chemistry, physics, and (non-computer) engineering. There are many grad students and professors in these areas who write software for their research that have no formal background in CS.
OK - I think I'm surprised to know that those fields do write software more than anything. Thanks for the clarification.
A member of my family is a post-doc here at Stanford doing cutting-edge genetic research on cancer in one of the brand new bazillion-dollar buildings that just opened. I write code for everything; I'll probably be writing code to brush my teeth for me someday, so I've offered to teach him to program. He doesn't show much interest. He says that there is only one member of his research team who can code--the PI--and he only knows Perl ("which is what they used in his bioinformatics program"). But, "He doesn't really write code anymore."

I don't know why I'm always surprised to hear this. You'd think I'd learn. I recently asked him if his research didn't require a lot of gene sequencing and analysis of the sequences and if that wasn't pretty computationally demanding. "Oh, yeah, sure it is. That's why we outsource it."

> There are two significant factions in the Python community: the scientific group and the web-dev group.

You forget the animation group. And the hardware/embedded group (Raspberry-Pi, anyone?). And the C-wrapper-writing group. And the sysadmin group. And and and...

The Python ecosystem is very large and diverse. That's part of its strength, and part of its weakness as well (it's very difficult to "herd" all these people, as this 3k migration has shown), but don't make the error of reducing it to the most vocal sectors -- they're not necessarily the most significant ones.

http://www.python.org/dev/peps/pep-3333/

Last-Modified: 2011-01-16 09:57:25 +0000 (Sun, 16 Jan 2011) ... Status: Final ... Created: 26-Sep-2010

Until this was made final(January 2011), web frameworks that use the wsgi spec had no python 3 path short of ditching the wsgi spec.

Now that it is final, there is a path to python 3 for web-dev. Cherrpy got there first I think. Pyramid/Webob got there, and others as well, and I'm sure Django will get there soon enough.

I'd say web-dev adoption of python 3 has been pretty swift.

Django has unofficially supported python 3 for a year.
Wasn't experimental support only announced just over a month ago?

https://www.djangoproject.com/weblog/2012/aug/19/experimenta...

There were unofficial versions of Django (forks, but not in the hostile sense) ported to Python 3 before that. The announcement marks the work being done in the main Django codebase, meaning that the next release will work on Python 3.
so, for about as long as pep 3333 has been approved. that was my point. No web framework that uses wsgi(pretty much all of them) were going to move to python 3.X without it.
> The scientific group is pretty much on board with Python 3.

Ah .. NO! I can assure you that we are still stuck with Python 2.x (2.7 to be more precise). I am not too sure the others would have moved either.

There is movement, though - lots of the core stuff is already ported to Python 3, and once matplotlib 1.2 comes out (any day now), it's quite feasible to do serious work with Python 3.
Can you list the reasons?
I deal with a lot of text data so I use NLTK for Natural Language Processing. In addition, maptplot lib for publication quality figures and graphs. I don't really have a motivation to shift to Python 3.
Have you looked at Pyramid? It's pretty awesome, really the ideal framework philosophy in my opinion (i.e., actually a framework instead of attempting to be a crappy domain-specific language/replacement standard library). It's also Python 3.x compatible and has been for several months (they replaced the one library they had been holding out for).

I gave Django a couple of truly honest tries, but I just couldn't bring myself to tolerate it. Pyramid is by far the best.

Python 3 support in django is coming soon....!
I think that Django support will probably speed up a lot the Python 3 adoption
I believe that the lack of WSGI held web-dev group back for a long time. PEP3333 (WSGI for Py3k) was finalized in early 2011, over two years after the release of 3.0.
As a PHP developer I've been waiting for the web-dev group to jump on board with Python 3 before I make the switch. I'm hoping it will be sooner rather than later.
I'm setting aside the question of whether or why to switch. I'm also setting aside the possibility of starting to learn now on Python 2.7, which is what I think you should really do assuming you don't intend to procrastinate it ;)

Assuming you do want to wait on Python 3 adoption, your timing should depend on the framework you want to use, because effectively each one has its own community and ecosystem, and their adoption is at completely different rates.

If Pyramid looks good to you, for example, it already is on board with Python 3. Bottle is on board with Python 3. If you want to use Django, which is what most people will want to do, you should just wait on Django to release a Python 3 version, and Django should be usable on Python 3 within the year. If you want to use Flask (considered the closest analogue of Ruby's Sinatra) then it could take a while.

I see a couple mentions in this thread of Flask taking a while to adopt Python 3. I am relatively new to Flask, could you explain why they are seemingly behind things in regards to Python 3?
The Flask author's post about issues he has faced with Python 3 might give some insight to that: http://lucumr.pocoo.org/2011/12/7/thoughts-on-python3/
There is some work currently going on to make Flask run on Python 3.2.

https://github.com/puzzlet/flask/commits/py3-dev

Few core developers (mainly, one, Armin) that couldn't be bothered enough. It's a volunteer project after all.

He did write about the unicode problems with the Python 3 changes and the need for an improved WSGI spec (heck, he even co-wrote the unicode literal change PEP).

But after the new WSGI spec was out, and the u thing was already implemented in 3.3 pre-release, there was no much motion in Flask, whereas Pyramid, Django and others have already started work.

Even the "When will Flask support Python 3" document has not updated and is 2 years out of date in it's contents.

Is the difference between 2 and 3 so huge that it is not possible to make a jump?
Here is my thought process...

Regardless of how you feel about PHP, I've spent enough time with it that I can make it work and write good code, quickly.

I do want to switch to another language at some point (I'll leave the reasoning for that out of this discussion).

Why switch to Python 2.7 if it's going to be old in a year or two? Even if there isn't a huge difference between 2.7 and 3.x it sounds like it would be a nightmare trying to upgrade any of the old work that I would have done in 2.7. So either I've got some projects that will be on 2.7 forever, or I go through the hassle of trying to upgrade. I'd rather just wait and avoid the whole debacle.

There are ways to write Python2 code that will work when you make the switch to Python3. It _is_ a hassle, but it's quite doable.

This may not convince you (and I perfectly understand why), but I think it's worth giving Python a shot even if you're fluent in another language.

Interesting, I'll look into it!
It's definitely possible (and not really hard), but I understand the mindset: if you're coming from an other platform, why bother with switching when you can wait a bit and just start with Python 3?
Because Python 2.7 is completely mature and production ready and also allows you to write code which runs pretty easily on Python 3. Then you are marking Python 2.7 as deprecated version at the time where before you would have been just getting started.

Really this is down to whether you want to do something in Python now, or you want an excuse not to do it in Python for some time. It's not a bad excuse but it's also not a strong reason to wait.