To Python or not to Python…

… is not a question anymore. All our students learn Python, starting the day they enter the university (and even before), and when teaching you are expected to integrate Python and programming whenever possible.

Of course, it makes sense for the university to promote the use of a free, open-source software rather than a commercial product like Matlab, but for all of us old (and not so old) lecturers at the university who – like me – have done your data analysis and plotting since the beginning of time in Matlab, it is not an easy switch.

I took a Python course more than a year ago, and I’ve done a bit of Python here and there, but for a long time now, it has been one of those uncomfortable “have-to-do” but “not-right-now” things that keep accumulating at the horizon. Until a month ago, when a twitter-thread by a colleague (Thanks, Angelica!) who had decided to take the step (and who enjoyed it!) finally got me to dive headfirst into the Python world… so, I read a Python – book (Python for Data analysis by W. McKinney) and set my mental default “program-to- open-when-time-for-science” to Python (or Jupyter, Python is a programming language, not a program). I did not go as far as to uninstall Matlab, but I’m only using it for emergencies…

I quickly realized that I’m Google-dependent – whenever I don’t know how to do something – Google is there to help, directing me to Stackoverflow or one of the thousands of Python tutorials that are available online. It seems like (almost) every question has been asked before – and that there is an army of Python-enthusiasts out there ready to answer and help*!

Now, Matlab and Python have much in common – it is not like I’m starting to learn programming from scratch. Maybe more like learning to speak Norwegian (rather than Chinese) when your mother tongue is Swedish? You understand what the Norwegians are saying (i.e. you can read and  – at least roughly – understand code that others have written), but to write your own Norwegian text and to speak… hmmmm, not so easy! You quickly get used to all the small differences – like that you have to start counting on zero and not on one, and that you have to use # and not % to comment out lines – but get accustomed to all the different types of variables in Python, to build up a vocabulary of commands and to  “think” in a python way, rather than “translating” your Matlab – way of doing things will take longer time.

I’ve lived more than a decade in Norway – but my children still laugh if I open my mouth and try to speak Norwegian… hopefully, it won’t take that long to be fluent in Python!