Python: serious language or just for beginners?

Python logo and code smapleTwo months ago I hadn’t looked at a line of Python code – it was never a requirement when I was a developer and as I moved into management I worked with teams and projects using everything from C and COBOL through LAMP to .Net, while Python sat on the periphery.  I’d always considered it to be a modern BASIC – something you did to learn how to code or for a quick prototype but not something to be taken seriously in a professional environment.

I’ve always believed that really good programmers understand the boundaries and strengths of multiple languages, able to choose the right tool for the job, and finding the correct compromise for consistency and maintainability.  People like this are really hard to find1 although I do tend to veer away from individuals who can only evangalise a single language and say all the others are rubbish2.  Due to the projects I’ve been involved with, Python ability has been irrelevant and never considered part of that toolbox.

In my new role I’m doing a lot of work with deep learning systems and Python is one of the languages of choice, which really took me by surprise.  At the ReWorkDL conference in Boston I spoke to several people who had been coding some pretty intense things in Python and I realised I ought to reset my views on it.

Firstly, it is very quick to put together functional, readable code, even for a beginner.  This makes it fantastic for academic settings where individuals trained in mathematics or neuroscience, for example, and not computing can learn how to automate tasks that would have a steeper learning curve in shell scripting or traditional languages3.

Secondly, Python is fantastic for big data sets – its generators handle iterative processes very efficiently.  Where you’re dealing with nosql data stores like redis or mongo and their extensive contents, python is a natural choice.

These two reasons have resulted in its widespread adoption in the deep learning community, which is owned by search engines, social media and academia.

Despite being interpreted, Python is pretty fast, and there are several projects aimed at making it even faster.  For me, the majority of things it is used for can be done more conveniently by shell scripts, but I can’t ignore the large amount of resources available on GitHub for Python that can be used as starting points.

During my research I have seen some beautiful code written in Python – efficient, easy to follow and confirms to standard programming principles.  I’ve also seen some of the worst code in public repositories that doesn’t follow any logical architecture4 and this is the problem.  Without a clear understanding of coding best practices, individuals learning to code can make the worst sort of functioning code in a way that traditional approaches wouldn’t encourage5.  So I implore anyone learning python to also read up on programming practices (despite being written in the 70s, Kernighan and Ritchie’s book on C is one of the best introductions to programming) specifically ensuring modularisation and optimisation of code.

I’ve come to realise that good Python programmers can do amazing things as quickly as good shell scripters, but mediocre and poor Python programmers can make extension and maintenance of code a nightmare you’ll want to dust off and nuke from orbit6.  A serious language I now agree, but far too much of it is written poorly.

  1.  I could do a whole post on the trauma of finding good people and may well do this at some point as it consumes a lot of my time for very little return
  2.  Usually they state their opinions much more harshly than this 😉
  3.  I partially disagree with this.  Apart from learning BASIC in the 80’s with everyone else in the world and a dabble with a few other languages as an undergraduate, I jumped straight into C for my PhD without issue.
  4. The only way to describe this is if you can imagine an AI coder taking all the code from StackOverflow that was tagged as “python”, doing a recursive merge and arbitrarily splitting the files every 500 lines so front and back end processes are combined into one “glorious whole” *shudders*
  5. This is by no means restricted to python, I’ve seen some abhorrent code over the years, from lots of sources, it’s hard to pick a favourite “bad example”
  6. It’s the only way to be sure

Published by


Dr Janet is a Molecular Biochemistry graduate from Oxford University with a doctorate in Computational Neuroscience from Sussex. I’m currently studying for a third degree in Mathematics with Open University. During the day, and sometimes out of hours, I work as a Chief Science Officer. You can read all about that on my LinkedIn page.