8 ms·
Python 2.x vs. 3.x survey results
- janzer 13y agoThese are the results from the survey that was on HN a few days ago. https://news.ycombinator.com/item?id=6990481 https://news.ycombinator.com/item?id=6990481
- ognyankulev 13y agoSo the bigger half of developers stick to Python 2 and the smaller other half actually tried migration to Python 3. After 5 years of promoting Python 3 as the future.
- sp332 13y agoThe original plan was for ~5 years as a transition period. Now that most of the popular libraries work with 3, there's a lot less holding people back (note dependency problems affect most of the responders). Also some of the cool features have been back-ported to 2.x so even projects that haven't migrated are benefiting.
- viraptor 13y agoFrom this short survey we can't really know if it's "developers stick to Python 2", or "have tried Python 3, but migrated because of X", or "haven't tried Python 3 yet", or "work daily on a project that will not be ported to Python 3 as long as possible". 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...
- njharman 13y agoThe reality is that after 5 years of development, i.e. around about now is when the promoting is just starting. A significant number of developers are early adopters who started using 3.x even before it is finished.
- nilved 13y agoA PDF? What is this?
- sp332 13y agoI know the link says .pdf at the end, but it's actually a webpage with the option to download a pdf. https://wiki.python.org/moin/2.x-vs-3.x-survey?action=AttachFile&do=view&target=2013-2014+Python+2.x-3.x+survey.pdf https://wiki.python.org/moin/2.x-vs-3.x-survey?action=Attach...
- Demiurge 13y agoThere we go... 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
- leephillips 13y agoPDF stands for "Portable Document Format". It was invented by Adobe; you can find more information about it at http://www.adobe.com/products/acrobat/adobepdf.html http://www.adobe.com/products/acrobat/adobepdf.html . 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.
- bru 13y agoI'm surprised, if not saddened, by the low popularity of `3to2`: less than 2% of the people surveyed have used it, even though it is a convenient way to have your code in python 3 when stuck with libraries that use python 2. edit: direct link to the pdf: https://wiki.python.org/moin/2.x-vs-3.x-survey?action=AttachFile&do=get&target=2013-2014+Python+2.x-3.x+survey.pdf https://wiki.python.org/moin/2.x-vs-3.x-survey?action=Attach...
- BonoboBoner 13y agoAs per results, if a lot of people are stuck with 2.x because of dependencies why would they bother with these tools?
- lmm 13y agoSame reason people use Coffeescript: even if you have to run on python2, it's still nicer to develop in python3.
- michaelhoffman 13y agoNot enough nicer to deal with any of the not-nice things that come with straddling the major version.
- rst 13y agoBut nicer by enough to make it worth the bother of invoking a translator before you can run your code? Projects using Coffeescript often go out of the way to hide that step, one way or another (Rails asset pipeline, etc.). And Coffeescript arguably improves on raw JS a whole lot more than Python3 improves on Python2.
- wbond 13y agoI would presume most people who are writing 3.x code have written 2.x code before, or don't care about 2.x. I personally have gotten used to the syntax that works in both, and tend to write my code in the most compatible manner possible.
- cvburgess 13y agoThe only thing really "keeping" me on Python 2.x is how easy it is to host it. Although Flask/Django/Bottle all support Python 3, most (if not all) PaaS providers I have used only support Python 2.7.
- toyg 13y agoHeroku supports 3.x fine, IIRC.
- cvburgess 13y agoLooks like you are correct [1] - this was not the case last time I checked. Thanks! Any others? [1] https://devcenter.heroku.com/articles/python-runtimes https://devcenter.heroku.com/articles/python-runtimes
- rockymeza 13y agoA problem with hosting Django on Python 3 on Heroku though is that you need to use something else (like s3) for staticfiles. Boto doesn't support python 3 yet, so you can't use the django-storages implementation. The Heroku documentation recommends using dj-static as an alternative to s3, but dj-static relies on a library that was last updated in 2009. New Relic seems to support Python 3 now though, which is nice.
- belluchan 13y agoBiggest dependency still keeping me back is Twisted, progress: http://twistedmatrix.com/trac/wiki/Plan/Python3 http://twistedmatrix.com/trac/wiki/Plan/Python3 It's either that or writing some blocking code or something. No thanks.
- nilsbunger 13y agoWould you consider Tornado? It's compatible with 3.x and even uses the new asyncio stuff.
- belluchan 13y agoI'm not familiar with Tornado but I wouldn't rule it out.
- falcolas 13y agoI moved away from Tornado recently; I was quickly getting lost in callback hell. This was at least partially due to using libraries which did not support Tornado's method of async io natively, and a lot more fear that even putting these outputs in threads would still cause delays we could not afford. I moved this project to Go, though I've quickly run into quirks there as well.
- Patrick_Devine 13y agoI'm in the same boat, but there do seem to be alternatives which are popping up. The problem is that there is a big difference between the Twisted way of doing things (deferreds), and everything else. Once you start writing code in a twisted way it's hard to port it to anything else.
- kingkilr 13y agoHave you considered contributing to Twisted's porting process?
- sitkack 13y agoTwisted is its own island.
- jcater 13y agoI find these responses promising. I see some negativity here that after 5 years, over half of the devs are still on Python 2. But reading some of the threads in the last few weeks, you would assume that fewer than 5% of all people attempting Python 3 stuck with it. And this survey, if it is representative of the community at large, obviously doesn't show that. 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.
- shadowmint 13y agoFewer than ~22% are sticking with python 3. Admittedly that's more than 5%, but I'd hardly call it a blazing success story, when 60% of people have tried it. So, 22% of 60% of people all up are sticking with python 3. 13%. Woo...
- jcater 13y agoWhere do you come up with 22% of 60% as sticking with it? The 22% I assume came from the question of which do you program in most. I program in Python 2 most currently too because of legacy projects. But I also do a lot in Python 3 as well, just not "most".
- drdeadringer 13y agoPython 3 meets my needs just fine. However, I do tend to live in the future.
- the_mitsuhiko 13y agoLess than 4% of pypi download stats are Python 3, so i doubt the results of this survey are representative.
- janzer 13y agoI'm wondering where that number comes from? I've seen this stat a few times recently but don't know where it came from. Just doing a quick perusal of the top 5 projects listed at http://pypi-ranking.info/alltime 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.
- Stubb 13y agoSpeaking from the perspective of someone who doesn't code in Python: I recently considered doing so for a scientific computing task at work but quickly ditched the notion. Python 3 seemed the recommended choice for a green-field project, but good luck getting anywhere with it due to poor library support. Want to access a MySQL database, generate 3-D graphics, or use someone else's code? Good luck with that! Python 3 may have been released five years ago, but uptake among developers appears negligible. So why not use v2.7? Several features in v3 looked appealing, and documentation makes it clear that v3 is the future. So I decided not to invest in a language that can't make up it's mind and stuck with R.
- Ixiaus 13y agoThis is unnecessarily pessimistic. Most of the major packages support Py3k and if they don't it's usually very simple to port over (it usually means combining 2to3 with some bytestring to string conversion debugging). 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.
- Stubb 13y agoThe shocker for me was seeing that MySQL-python didn't support v3. And I recall all sorts of problems getting IPython 3 running in Emacs alongside the system version of Python 2. Porting a library to v3 was more than I was willing to bite off and a brand-new user when I had a customer deadline approaching.
- nknighthb 13y agoI haven't used MySQL-python in years. It's long bordered on being utterly unmaintained. Use oursql or pymysql.
- Aqwis 13y agoI was shocked by MySQL-python not supporting Python 3 as well, but then I discovered that there are several better alternatives to MySQL-python that do support it, such as pymysql. AFAIK it's 99% compatible with MySQL-python.
- deleted 13y ago[deleted]
- jpmc 13y agoA different view of the data. https://docs.google.com/spreadsheet/pub?key=0Aj15Prf9CEepdGxfeExINHZYbUNXWUFDTkhobWd2a3c&output=html https://docs.google.com/spreadsheet/pub?key=0Aj15Prf9CEepdGx...
- thinxer 13y agoNowadays most libraries have python 3 versions, but not every machine has python 3 (or even 2.7) installed. Most of times it is very difficult to install softwares on those machines. The availability of python 3 is my major concern.
- waleedka 13y agoI was pleasantly surprised by these results. Language adaption is not linear, it follows an S curve. So while 22% are on Python 3 after 5 years, we can expect to reach 80% much faster.
- berkut 13y agoWhat's also missing here is differentiating between "dependencies" as other python libs or host apps with built-in python interpreters stuck to a particular version. 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...
- Keyframe 13y agoOne solution would be to provide the two in parallel. But then again this area is slowly moving. I just recently (early last year) wrote my last MEL code and moved fully onto python.
- berkut 13y agoYeah, but that's quite likely (without some sort of façade layer) going to be double the work adding new functionality, and it's definitely going to be twice the testing of the entire Python functionality of the apps.
- klodolph 13y agoSome are stuck on the 3.x series, like Blender.
- sitkack 13y agoWhat we _really_ need is a way to manage python2 and python3 codebases, infact we need a story to manage pythonN+ codebases interoperating in the same process. How is this a one time event? It isn't, nor should it be. Everything is future legacy. 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.
- stefanu 13y agoI would love to move to Python 3 as I have no technical dependencies. The only reason I'm still writing my code and open-source library in Python 2 is the ecosystem of my clients. Even if that was technically possible to migrate to Python 3, it might not viable business-wise. It would be considered as unnecessary expense for something that "just works". I guess we just need to reach some adoption tipping point or end of support of Python 2. Whichever comes first.
- maxerickson 13y agoI kind of get the sense that a lot of the recent belly aching is because people can smell the adoption tipping point coming.
- dded 13y agoI thought about this, as someone with reasons to prefer Python2. But then I quit worrying. Python2 isn't going anywhere, for starters. But more to the point, if lots of people move to Python3, some of them will share my issues. They'll make noise, push for resolution, offer solutions, etc. Widespread adoption makes it more likely that my concerns will be addressed.
- Siecje 13y agoOne thing I don't understand is if there are third party libraries holding people back then why isn't there something in the python 3 standard library that you can substitute?
- robomartin 13y agoPython 3.x has to be the future, there are lots of really well articulated reasons for that. The problem here is that the transition was not, in my opinion, handled intelligently. 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.
- hit8run 13y agoWhat are the conclusions from this survey?
- e12e 13y agoFor those interested in python 2/3 that haven't (recently) read the (unofficial) faq, I highly recommend taking a look: http://python-notes.curiousefficiency.org/en/latest/python3/questions_and_answers.html http://python-notes.curiousefficiency.org/en/latest/python3/...