By Kaitlin Logie, 20th October 2016.
Python? Never heard of it.
Python is a dynamic, object-orientated, interpreted, high-level programming language. It’s high level, built-in data structures and its simple syntax make it a very attractive programming language for anyone from beginners to researchers and software developers. Python’s easy to learn syntax emphasises it’s readability and reduces cost of maintenance. Python also supports packages and modules which encourage modularity and recyclability of code.
The best thing about Python is that it’s FREE and completely open source!
Python and Research.
Python is a great research tool! It’s simple syntax makes it perfect for translating messy notepad scribbles into functioning code. This bridges the gap between the phases of generating ideas and trying them out efficiently. As a researcher, you don’t have to learn the entire python syntax and understand what is going on under the hood to be able to write a program in python. A simple knowledge in google searching is all you need (as well as some common sense and logical knowledge of problem solving)! Python is extremely well documented in online forums. Not only this but it’s readability makes the raw code extremely human readable. Python’s syntax is very well thought out, and easy to compare with other languages and pseudocode to solve problems.
(image by Ravi)
Like any programming languages, there are many editors that allow for coloured syntax. If you are like me and like your code looking pretty there are many editors available that make this a reality. Python editors have some of the most creative additions, such as font changes and whole structure adaptations! The world is your oyster.
- It is so easy to read and understand! Not only does this help you think clearer, but it helps other researchers/developers understand your code in detail. It makes it easy to develop other people’s code and share knowledge which is what research/development is all about! It requires less effort to write a program in python, then other high-level programming languages. The easier the code is to understand the easier it is to maintain.
- Python is extremely popular in academia leading to a huge talent pool! This has created vast help tools and software support all over the internet freely available for anyone to access.
- Although using the standard python library is an effective research tool on it’s own, you can also import open source 3rd party libraries! Code that other people have already manufactured to help you complete certain problems. For example BioPython, is an excellent library for bioinformatics and genomics! Sequence DNA, translate it, transcribe it all using simple functions.
- Python programs/functions can also be called from many other programming languages such as MatLab. This can help make harder parts of the problem easier to solve and understand if the language you are using is extremely complicated.
(image by Salim Fadhley)
Are there any cons?
Yes of course there are! There is no such thing as a 100% ‘perfect’ programming language. The main problem you may encounter with python is speed. Because it is an interpreted programming language, programs may run/execute much slower compared to compiled programming languages. You sacrifice speed for simplicity with Python. But there are Python packages out there that have been optimised to try run as fast as compiled languages.
How do I learn python?
There are many online resources that help teach Python and help with your Python install. Software Carpentry is one of the most widely used and endorsed online Python lessons. The Centre for eResearch at The University of Auckland also offers their own interactive workshop if you want more human-human interaction. Otherwise come along to our Hacky Hour or send me an email at firstname.lastname@example.org to set up a Hacky Hour appointment and I will personally help you in anyway I can!