6 ms·
Python 2.x vs. 3.x use survey
- bru 12y agoLast year a survey was conducted on python 2 and 3 usage. It sparkled interesting discussions on HN: https://news.ycombinator.com/item?id=6990481 https://news.ycombinator.com/item?id=6990481 "Python 2.x vs 3.x use survey" https://news.ycombinator.com/item?id=7005711 https://news.ycombinator.com/item?id=7005711 " Python 2.x vs. 3.x survey results" Here is the 2014 edition, slightly updated (from 9 to 11 questions). It should not take you more than 1 minute to fill. I would be pleased if you took that time. The results will be published around the end of the year.
- markolschesky 12y agoCan I sign up for something to see when the results are released?
- svisser 12y agoWhere will the results be published?
- arenaninja 12y agoThis reminds me of a Flask mini project I did. I was doing it in Ubuntu (LTS if I'm not mistaken). I picked python3 and ran with it. As I tried to use Python's virtualenv (venv), I went down the rabbit hole of a broken mess that was left in Ubuntu. I just reinstalled Ubuntu this week so I might give it another shot, but every time I try to do something with Python I end up with a broken mess, and that's disheartening
- teabee89 12y agoYou could use Docker, that way your host Ubuntu is kept clean. docker pull python:2.7 docker pull python:3 For more granular tags: https://registry.hub.docker.com/_/python/ https://registry.hub.docker.com/_/python/
- valarauca1 12y agoI think the problem that is being had is Ubuntu packages. Which Docker in and of itself won't solve. All it will do is isolate packages from the rest of the OS. Which python is fairly generic, and building your own python libraries, and gutting python packages from Ubuntu will have the same affect. Either way you are hand installing a lot of packages.
- pekk 12y agoI'm also sorry that Ubuntu broke venv, but there were many (edit: at least a few that I remember) attempts to file tickets to get that fixed in Ubuntu, lots of stupid arguments against fixing it
- arenaninja 12y agoIt definitely turned me away from Python yet again for the time being. I'm now rewriting that same project in Laravel. I understand that it's not python's fault, but every time I've tried to use it some package is broken, and the alternative is going back to python2
- dschep 12y agoAFAIK -mvenv is still kaput in Ubuntu. I just this instead: sudo apt-get install python-virtualenv python3 virtualenv -p/usr/bin/python3 <venv> Yes, it'd be way cooler if -mvenv wasn't crippled in Ubuntu, but this still works fine.
- arenaninja 12y agoYea I was doing this until I also ran into a horrible mess later on due to the underlying issue that resulted in a catch 22 (something like pip is broken because venv is broken because pip is broken...). Unfortunately I didn't see [this tweet](https://twitter.com/danilobellini/status/461653494295179264 https://twitter.com/danilobellini/status/461653494295179264) at that time, or things might have turned out differently
- jostmey 12y agoStopped using python in my research. Now I stick with Matlab/Julia.
- turnip1979 12y agoWhy did you stop? Surely, the 2.x vs 3.x schism didn't cause this?
- ylem 12y agoWhy? I ask because I switched from using Matlab to using python. I found Matlab was great for getting things done, but it was difficult to maintain/distribute larger projects--much less deal with interfaces to the web, etc. I also found (at the time) that parallelization was easier with python. I haven't experimented with Julia.
- tmalsburg2 12y agoI stopped using Python in my research, too. Now I'm using R which is so terrible as a language that for the first two years I felt insulted every time I wrote code in it. However, I stuck with it and even like it now because it has an amazing ecosystem. (I also got used to expressing things in terms of vector and matrix operations.) Julia is promising but things are still too much in flux for my taste to consider it for serious work. I have no doubts about Julia as a language but I'm not sure if they are going to able to build an ecosystem like R's. They're not always making it easy for R developers to switch. Fortunately, some R veterans like Doug Bates are heavily investing in Julia. I hope others will follow.
- Animats 12y agoThat's a useless survey. Answers by random people aren't particularly useful. It doesn't reflect how much of a Python code base one is responsible for. Analysis of major code bases written in Python would be more useful.
- pekk 12y agoTo be pedantic, answers by randomly sampled people would be more useful than this, which is so skewed it's useless. In either case, it's irrelevant
- schoen 12y agoI was super turned off of Python 3 when it came out and I promptly tried it and ran open("/dev/urandom").read(20) and was confronted with UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 2: invalid start byte If I had realized at the time that this error would be averted with open("/dev/urandom", "rb").read(20) I might have felt more charitable and less shocked (although I can see in retrospect that there's quite a good reason for this error, I might have preferred for the default file type to be binary -- presumably something that was debated extensively inside the Python 3 development effort).
- viraptor 12y agoYour first version was already not correct/portable. When reading binary files on Windows, you have to include the binary mode. Otherwise you'll drop bytes semi-randomly. This change only made that mistake visible on other systems.
- ma2rten 12y agoThere is no /dev/random on windows anyway. Not every piece of code has to be portable.
- schoen 12y agoYes, I definitely wouldn't have expected or intended that code to work on Windows.
- viraptor 12y agoIt doesn't have to be, but going for a more correct/portable code (than absolutely necessary minimum) helps avoid such problems. In this case binary file was opened - if the "rb" mode was added anyway, the exception mentioned above wouldn't happen. Edit: Actually python doesn't even mention windows. It's simply "Add a 'b' to the mode for binary files." (in python 2.7 documentation) According to the docs it should be specified regardless.
- thusoy 12y agoThe easiest version is the most portable and easy to read in this case: os.urandom(20) Saves you from having to manage files at all, and works cross-platform.
- hpaavola 12y agoI mainly use Python to write Robot Framework libraries. RF needs to support Jython, Jython will not support Python 3 in near future, so I'm stuck. There is a Python 3 fork of RF (https://bitbucket.org/userzimmermann/robotframework-python3 https://bitbucket.org/userzimmermann/robotframework-python3) which I might use next time I get to start writing RF libraries from scratch.
- cjlarose 12y agoMeanwhile, the Python 3 Wall of Superpowers is looking really good. 166/200 major watched projects are Python 3-compatible. https://python3wos.appspot.com https://python3wos.appspot.com
- martinvol 12y agoPython 2 was supposed to be dead at least 2 years ago and still 34/200 major watched projects use it.
- sp332 12y agoWell, dead may be a bit strong. Old projects that use 2.x have no good reason to migrate to 3.x, and 2.7 will be supported until 2020 at least.
- Alex3917 12y agoThe google-api-python-client is what bothers me the most. They work on convincing top CS departments to teach CS101 in Python, and as soon as the majority switch it feels like they've kind of abandoned the language. From what I can gather from Github, it looks like there is all of one person working on this part time.
- briancurtin 12y agoI don't know where you got this, but it was never planned to have been dead two years ago. 2.7.0 happened in July 2010, and regular bug and security fixing would still have been happening up until around this time regardless of anything else (fwiw, 2.6 went from 2008-2013). Instead, we decided earlier this year to extend that support until 2020.
- toxik 12y agopylibmc was ported to Python 3.x in its latest release, but the wall of superpowers hasn't updated in days!
- chhantyal 12y agoIndeed, it is ported. You can see updated list here: Python 3 Readiness (http://py3readiness.org http://py3readiness.org)
- deleted 12y ago[deleted]
- falcolas 12y agoStill on 2.x, simply because it's a lot easier to use the generally available system packages than constantly rolling/building your own. 2.x is not missing anything I need, so there's simply little incentive to migrate my code to 3.x until the package support is there.
- ghshephard 12y agoGenuinely curious - which packages are you missing in 3.x?
- bashinator 12y agoI think falcolas means that python3 is not available as a native package (i.e. apt-get, yum install, etc) on the systems s/he programs for.
- agentultra 12y agoI write all of my side projects in Python 3.4. I only write 2.7 because I work on Openstack at my day job. I avoid the use of Python 2 in every situation I can. Python 3 has better modules built-in; the existing modules have been cleaned up; a cleaned up language (no more xrange, lazy map/filter/reduce, explicit byte-stream encoding); an improved language (sub-generators); optional type annotations; configurable allocators (in Cpython). I just prefer it to Python 2 these days. edit: And all of the upstream effort into making the language better is going into Python 3.
- merlincorey 12y agoAs one of those crazy functional programmers who uses python, can you please explain to me what the benefit is in remove xrange, lazy map/filter/reduce, and other functional mainstays in exchange for what is essentially more syntax to do the same?
- bachmann1234 12y agowell, range in python 3 is lazy. They replaced the non lazy implementation with xranges impl. Same applies to map, filter and I believe reduce as well.
- maxerickson 12y agoIt's the other way around, they are not removed, the default implementations are now lazy. So in python 3 you get an interator: >>> map(lambda i:i*i, range(5)) <map object at 0x010622F0> and have to explicitly construct a list: >>> list(map(lambda i:i*i, range(5))) [0, 1, 4, 9, 16] >>>
- merlincorey 12y agoAh, I actually like that! That is indeed cleaner. Thanks for the explanation.
- agentultra 12y ago
- tesq 12y agoThis seems more of an outlet to vent and quantify the frustration of the Python 2 to 3 migration than it is a 2 vs 3 use survey. I transitioned to 3 over a year ago and haven't looked back. I am happy with how the ecosystem has adapted and the direction Python is taking. Type annotations, liberal use of and expansion of syntax for generators, language cleanup and additions to the standard library really make it another and better language.
- hit8run 12y agoApp Engine supports Python 2.7. this was a deal breaker for python 3 usage for me.
- nichochar 12y agosame here. And I don't think google is putting a lot of resources in appengine (python) anymore, so I don't think this is going to change soon.
- JelteF 12y agoGoogle is super slow in supporting Python 3 for anything, their python API client still hasn't been ported. It's the only dependency for one of my old projects that makes it unportable to Python 3
- Svenstaro 12y agoWe use Python 3 for our current Flask projects with lots of dependencies without much trouble. Granted, we had to fix two libs for compatibility but it wasn't a big deal. It's pretty smooth sailing for us.
- Mikhail_Edoshin 12y agoThe only app I wanted to use that required v3 Python was Beancount, but I couldn't get it to work, because it required v3.3, while Cygwin only has 3.2 and I myself was unable to compile Python v3.3 or later on Cygwin. (It doesn't work as it is, I tried to google and apply patches, got it to compile, but tests failed, so I gave up; no Beancount for me.)
- jlarocco 12y agoIs it just me, or are questions biased towards Python2?
- bcj 12y agoUnfortunately, I think they are just based on the reality of the situation. According to the person who is responsible for PyPI, ~5X as many people use 2.6 than 3.X.
- vegabook 12y agoLet's be honest. The fact that surveys like this are still around 6 long years later has just become boring. I have moved to Python 3 purely because of asyncio. There is no other reason that I have found Python 3 to be compelling for. When I write Python 3 now, I feel like my favourite language has gone all "serious" on me, like it wanted to grow up, and has lost a lot of its charisma on the way. I actually liked the print operator for example - it's probably the reason I chose python in the first place when I saw >>> print "hello world" for the first time. That's it? So clear and simple! 3.0 has lost some of that. The unicode thing is also just irritating because 99% of the time ascii works very well and is less complicated, thank you very much. Also, no matter what anybody says, you still bump into libraries that you need that are 2.x only (in my case Bloomberg). It doesn't matter if most libraries are ported if just one library that you need is not ported yet, you're back to 2.x. Imagine you're an average coder who uses say 8 libraries. By the ratio of 15% not yet moved, you're almost certain to have a problem (1 - 0.85 ^ 8 > 70% chance). Anyway I have been able to manage because I have isolated the 2.x dependencies in another system, and I have put in the effort only because I really like asyncio, and it's finally clear to me that Python 2.x has no future. That said, and taking that logic even further, the very fact that this 2v3 issue is still around is irritating, and has been irritating a lot of people for a long time. I am wondering about going the whole way and moving to another language altogether (Golang and/or functionals). One more thing to point out. If you're beginning in Python, the vast majority of code samples on the internet are 2.x. That's fine if you have any clue about Python as the surface differences are not that large, but it is definitely a pain if you're expecting to copy and paste and have things "just work".
- falcor84 12y agoI really miss the ease of the print statement and therefore was very happy to discover ipython's automatic parentheses - http://ipython.org/ipython-doc/dev/interactive/reference.html#automatic-parentheses-and-quotes http://ipython.org/ipython-doc/dev/interactive/reference.htm... Activating this option allows the parser to automatically infer function parentheses, just like in ruby. Though ruby still wins by virtue of its single letter `p` function.
- 12y ago
- deckiedan 12y agoWe use a lot of python stuff at work for automation, moving large video projects around, etc. And since on all the OSX machines python2 comes pre-installed, but there's no py3k, it's a lot easier just to stick with that. It also means the scripts work out of the box on Ubuntu, Debian and CentOS - although for some of our older CentOS installs I have to stick w/ 2.6, which is a bit of a pain.
- lordbusiness 12y ago2.x since it's widely available on systems. I do DevOps work.
- jpiabrantes 12y agoI wish Python 3 was never born or Python 2 got murdered when 3 was born. Both of them live at the same time it's the worst thing.
- jlawer 12y agoPython 2 is already on all my systems (OS X, Centos 5/6/7). Python 3 needs to be deployed. Since I write a lot of sub 1000 line scripts for system admin tasks, it tends to not be worth forcing a Python 3 dependency just to make some small task easier. Finally there are still a few really useful libraries that are python2 only (such as pysphere for vmware vSphere) and salt (saltstack) runs under the system python instance (py 2) that most code I write is still python 2. Most of the code I write I try and write it so it should work on both, however without being tested and due to the nature of fairly quick development and limited testing, its almost certain there will be a few issues with running on Python 3. Once they can convince Red Hat to replace the system python with python 3 (which will require some major work since I believe yum and a lot of other python code is not compatible), I think you will see a lot faster decline.
- Scramblejams 12y agoIf Twisted Matrix isn't on Python 3 then neither am I.