|Python 3 For Science - A Survey|
|Written by Janet Swift|
|Monday, 18 May 2015|
Python is a popular language for science - but the scientific community seems to be happy with Python 2 and reluctant to progress to Python 3 as revealed by a new survey.
The survey, which is a follow-on to one conducted in 2102, comes from Thomas Robitaille, aka astrofrog, and its results are discussed on his .py in the sky blog.
Robitaille is one of the coordinators of the Astropy package and his initial survey was to find out which Python, NumPy, and SciPy versions scientists were using in order to know which versions Astropy should support. At the end of 2012 he discovered that while a high proportion of respondents had reasonably up-to-date Python installations, virtually no-one was using Python 3 for daily work. This was on the basis of 313 responses.
This year's new survey attracted over 780 responses from scientists, more than half of them astrophysicists, which is unsurprising given the the survey was publicized using social media, and over 80% of them use Python 2 rather than Python 3.
Although the blog post announcing the results has the subtitle "the great migration has begun!" I'm not sure that would be my conclusion. Instead I would draw from this that a "trickle" of users are now moving to adopt Python 3.4.
I can, however, agree with what Robitaille has to say about it in terms of supporting Python versions:
Based on this, I would argue that the main versions that need to be supported are Python 2.7 and 3.4, as well as 3.3 (since it is not a negligible fraction of Python 3 users). Support for Python 2.6 as well as 3.1 and 3.2 can essentially be dropped.
Python 3.0 was released in 2008 but at this time it was a poor relation of Python 2.6. Python 2.7, the last in the Python 2.x line was released in 2010 by which time Python 3.1 was still struggling to get adopted. Python 3.3 was released in 2012 it was certainly a workable alternative and version 3.4 in March 2014 started to look like a strong contender.
You might expect therefore that those who have been using Python for the least time might be the most likely to use a version of Python 3. This is indeed the case - but this group also has the highest percentage of Python 2.6 use - but when you realize that over 6% of respondents have used Python for less than a year then this is just 3 individuals,
One interesting finding is that among Windows users in the survey, who have to install Python for themselves rather than use the version that comes with the operating system 40% opt for Python 3.x. However Windows users are in a minority (9%) in this survey, with Linux being the majority OS (51%). MAC has 40% of the operating system share and only 12% of MAC users prefer Python 3.x over Python 2.7.
The survey also asked about why users don't use Python 3.
No incentive is by far the most popular excuse and the fact the Python 2.7 is to be supported until 2020 plays into the hands of those who are of the "if it ain't broke don't even think about making a change mentality". The response "Some packages I need aren't supported" may by now not be accurate as a lot of effort has been put in to ensure Python libraries do support Python 3. Code not working in Python 3 is going to be a problem - but increasingly you can achieve more with Python 3 and so it is probably worth the effort to re-write the old code. So while it was a mistake to introduce Python 3 without backward compatibility, it probably shouldn't still be used as a reason for not moving forward.
On point Robataille makes, that I agree with, is that no-one should now be introduced to Python using version 2.x Many MOOCs and on-campus courses have stuck with Python 2 and this he says is:
all wrong – we should be teaching new users to use Python 3! New users won't thank you if you teach them Python 2 and they have to migrate all their scripts to Python 3 in a few years... I would strongly encourage any of you involved in teaching Python to switch now to using Python 3, even if you don't use it yourself
To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin, or sign up for our weekly newsletter.
or email your comment to: firstname.lastname@example.org
|Last Updated ( Monday, 18 May 2015 )|