Python 2.x vs. 3.x survey results
wiki.python.org
wiki.python.org
Sure, more people use Python 2 than 3, but is that really surprising with the legacy code out there? The point is that Python 3 is also being used quite a bit.
This is laughable: "we asked people with a vested interest in seeming more numerous than they are to take our survey. And they did. Reassuring!"
So, 22% of 60% of people all up are sticking with python 3. 13%. Woo...
Just doing a quick perusal of the top 5 projects listed at http://pypi-ranking.info/alltime
1 (boto) does not support 3.x
3 (distribute, zc.buildout and pip) only distribute non-version dependent files
leaving just 1 (lxml) with version dependent installers listed at all and it is only for the windows installers.
Drilling down into lxml, roughly 95% of its downloads are the version agnostic .tar.gz file. Also the version dependent installers do not include a 3.3 version but only 3.2 for python3. But even with only an installer for a old version of python3 available it still is >8% of version dependent downloads.
As a number of people have pointed out though, there's no new data since May 2013, no idea why (https://bitbucket.org/pypa/pypi/issue/33/package-stats-no-lo...), so the the '4%' number is probably out of date anyway.
I know that's why I returned to 2 after trying 3. For example BeautifulSoup (HTML parsing/scraping) has only supported Python 3 since October '13. There was nothing wrong with 3, it was just dependency issues.
Plus, when 2.7 was released it was done with a promise of ~6 years of support[0] to aid in the transition to 3.x. I think the definition of success here needs to take that into account.
[0] - https://mail.python.org/pipermail/python-dev/2010-May/099971...
However, I do tend to live in the future.
For example, VFX studios are generally stuck on 2.6.4 as that's what Maya 2012, Nuke 7 and other commercial software is using.
Lots of VFX studios have hundreds of thousands of lines of Python code integrating stuff across their pipeline. Until the host apps support Python 3 (some like Houdini support both 2/3 via different plugin proxies), it's a Chicken and Egg situation, as VFX studios won't port their python code to 3 until they need to, and the commercial companies making the software above aren't going to waste time adding Python 3 support until their customers ask for it.
So I'm assuming 2.6/7 is going to be around for a while...
Versioned imports down to the language level. Each file should say what version of the language it uses. Code once written that works should not fail to work in the future.
I don't think Python 3 was a mistake. I understand the reasons for doing it, and the difficult decision making process there. I also have tremendous confidence in core dev team and Guido to make the right decisions even if they are difficult.
However, I think calling it Python-next or -NG or something non-numerical would have been better, and CLEARLY signalling that Python 2.x IS NOT DEAD. The big problem is that 3 is bigger than 2, and by advertising that 3 is not yet ready but 2 will no longer be supported, there is sort of an Osborne effect (http://en.wikipedia.org/wiki/Osborne_effect) that is hurting adoption of Python 2 AND Python 3.
"Python 3 is the future" but "Python 2 is also the immediate future", like for the next 3-4 years AT LEAST. My company is undoubtedly going to need to support it for well beyond that. There is no problem here. Python 2 evolved so much over its point revisions that the idioms in 2.7 for instance are vastly more concise and improved from 2.4. Would it have made sense for someone to not learn Python 2.4 just because eventually 2.7 would improve or deprecate some of the things they'd learned?
Looking through the main python.org page through the eyes of a beginner, it's hard to find clear guidance on this.
My company is squarely in the space of promoting the use of Python for scientific computing and data analysis, and it's difficult sometimes to get folks in the community to recognize the difficult job of ambassadorship to other languages, like R, Java, C#, etc. That being said, there is still tremendous adoption of Python for data and scientific purposes, so I'm not really worried. I'm just sad to hear that a potential newcomer was driven away by unclear messaging.
(Especially to stick with R... <shudder> :-)
It's a bit unfair to try to group the actions of vast swaths of people under the same banner, and penalize them for not acting in concert.
Why isn't the entire Python community using 100% Python3 right now? Because they are a disparate group of people with differing motivations and goals. It's only been in the last year that some major projects have started to support Python3 (e.g. Django). Not everyone has the luxury of spending all their time porting over existing code-bases to Python3 the moment that it's possible.
Developing in Python also seems an either/or proposition: either you target v2 or v3. This puts library authors in the unenviable position of supporting two code bases.
I'm not in the scientific field so forgive me if I'm being parochial but I've been writing software in Py3k exclusively for a year and half now. Using scientific computing, distributed queue processing, webapp, CLI utilities, etc...
[EDIT] Better words.
Remember, he's looking at using Python for the first time. I work in Perl-heavy environments, and I can assure you that the 2/3 split in Python is a reason that many will give for not using Python at all. It's very different among those who are already comfortable with Python.
> Most of the major packages support Py3k and if they don't it's usually very simple to port over
For you, maybe. He's just starting with Python.
With regards to scientific Python, I took a peek at the install link on the Ipython site. It says that Ipython works with Python 2.6, 2.7, and >= 3.2. That was only mention I saw (in an admittedly casual look) for Python3. All the examples were in Python2.
I don't know Python, but I've gone through a few phases where I'll play with it for a bit and then put it back down. (Incidentally, I appear to be entering a "play" phase right now.)
I can't explain it exactly, but the 2/3 thing makes me really uneasy about learning the language.
On one side, there is Python 2 which is supposed to die in the non-immediate future. I don't need to learn it, particularly since development isn't my primary career at the moment and I'm unlikely to "need" it before I inevitably switch careers back to dev. If I don't need it now, and I don't expect to be in a situation where I need it in the near future, why not go for Python 3 right away?
On the other side, Python 3 is the new hotness, and it's the future of the language. It's the heir apparent. It's going to be "the" Python in the nearer-than-you-think future.
But it doesn't seem ready. You get the impression that you'll start a greenfield project and then get to a point where you want to drop in a well-known component and you just won't be able to.
You also look at the fact that it's been around for over half a decade yet 80% of of respondents to this survey say they use 2 more than 3, 40% have never touched it, and 20% say the whole thing was a bad idea. If you were walking into that environment, would you really be so quick to disregard it?
I suppose the answer is to just learn it all and try to keep the differences in mind as you go, but it's understandable the a lot of people don't want to half to learn and semi-unlearn the same language all at once.
If you wanted to be safe you'd just start with 2 as it's easier to get help while learning the ecosystem. There's actually not much to learn / relearn when switching - the difficulty has been moving the dependencies to 3 (which is well underway now).
MySQL driver 1: http://pythonhosted.org/oursql/ MySQL driver 2: https://github.com/PyMySQL/PyMySQL
Both are well supported drivers. Much nicer to use than the old Python2 only MySQL-python driver, imo.
I agree completely on the graphics side, though. Terrible.
edit: direct link to the pdf: https://wiki.python.org/moin/2.x-vs-3.x-survey?action=Attach...
Conversion tools are mostly a relic of when everyone still had to support 2.5. Once you are 2.6+, most people settled on single source as the best approach.
Do you have experience with the `six` library[0]? I've read a few times about it recently and it seems a convenient way to write portable code. I still wait for an opportunity to use it!
[1] https://github.com/twilio/flask-restful/blob/master/flask_re...
Of course, I could very well be unfairly judging 3to2, but I don't have unlimited time and spent longer than I would like trying to get 2to3 to do what I wanted.
It's either that or writing some blocking code or something. No thanks.
I moved this project to Go, though I've quickly run into quirks there as well.
I would expect that the last group is really big - imagine a company with a huge python 2 codebase. You're not going to just say "let's port everything" without a good reason for it. Even after you do, you have to port and prove all your dependencies are working correctly, only then going for the big projects. So while most people will still describe themselves as people working primarily with python 2, there may be a person or two in their teams, who already work on porting...
Any others?
New Relic seems to support Python 3 now though, which is nice.
https://docs.google.com/spreadsheet/pub?key=0Aj15Prf9CEepdGx...
What I mean by this is that in five years there are a number of things that could have been introduced incrementally and with minor impact to existing libraries. For example, making range() behave like xrange() seems trivial from a user's point of view. The same with print vs. print().
Yes, some of the other important differences would require breaking code in more serious ways. This, too, over five years, could have been introduced with incremental transition tools that would make the upgrading of existing libraries as automatic as possible.
If a language doesn't have massive and useful libraries you can play with it and break it. Nobody will care and adoption will be swift. That's not the case with Python. Aside from language benefits I'd say the main differentiating reason for which Python is really valuable is that there are libraries out there to do just about anything you want. Breaking (or un-breaking, depending on your perspective) the language breaks the libraries, therefore, no matter how wonderful the language might be it is a non-starter.
The transition from one version to the next has to be automatic. Nobody has the clock cycles to engage in months' long research projects to comb through code and fix things. No, tools like 2to3 are not what I am talking about.
One non-coding example I can offer is what happens when you open an old Solidworks file with a newer version of Solidworks. The program immediately fires-up a format converter and tells you it is converting to the new file format. Once done, you save and you are done. All you have to do is open the file and re-save it. That's how it should be. Surely in this day and age there's enough CS intelligence out there to make a fully automatic version-to-version converter. Now that would be something. It would certainly bring the Python community forward in unimaginable ways.
I'll go further and suggest that this could actually be an idea that could set Python apart: No new version is released without a matching fully-automatic old-to-new converter.
Hey, ideas are easy.
http://python-notes.curiousefficiency.org/en/latest/python3/...
I guess we just need to reach some adoption tipping point or end of support of Python 2. Whichever comes first.
It's an excellent format for sharing documents, because, unlike, for example, HTML, it preserves formatting exactly and it can be self contained: you can embed all the fonts for a document within the PDF. It has some disadvantages compared with HTML: it doesn't reflow and is slower to search through, for example. But when you need or want a document's formatting to be preserved in detail, PDF and Postscript are the only open specifications you can turn to, aside from just using images.
I appreciate the text-based version that was posted in this thread, thank you!
The comparison to Excel is absurd; PDF is an open format and has been for more than five years.
Q1 Have you ever written code in Python 2.x?
Yes - 97.51% 4,660
No - 2.49% 119
Q2 Have you ever written code in Python 3.x?
Yes - 60% 2,862
No - 40% 1,908
Q3 Do you currently write more code in Python 2.x or Python 3.x?
Python 2.x - 78.09% 3,692
Python 3.x - 21.91% 1,036
Q4 Do you think Python 3.x was a mistake?
Yes - 22.91% 1,071
No - 77.09% 3,603
Q5 Do you have dependencies keeping you on Python 2.x?
Yes - 61.46% 2,883
No - 38.54% 1,808
Q6 Have you ever ported code from Python 2.x to Python 3.x?
Yes - 32.83% 1,554
No - 67.17% 3,179
Q7 Have you ever written/ported code using 2to3?
Yes - 16.27% 768
No - 83.73% 3,953
Q8 Have you ever written/ported code using 3to2?
Yes - 1.93% 91
No - 98.07% 4,627
Q9 Have you ever written/ported code to run on Python 2.x and Python 3.x unmodified?
Yes - 31.12% 1,473
No - 68.88% 3,261