Why it’s time to take the plunge into Python

Ahead of our new Python evening course, instructor Andrew Buchan explains why it’s such a popular language.

People come to Python for many and varied reasons. Some discover it via Arduino and similar projects, while others get into it for data analysis in science or engineering. Others use it for automating IT tasks.

Python is the language of choice for many programmers, but why should you consider adding it to your skill set?

User friendliness

For anyone who has studied other programming languages, such as Java, C++ or C#, the first point of appeal is perhaps the absence of ugly horrors such as this:

//Java's Hello World
public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!");

When Python lets you do this:

print "Hello World!"

Although this is a simple example, it’s just the tip of the iceberg in respect to the thought that has been put into making Python a user friendly language to work with.

This is true not only of syntax, but also core aspects of how Python works such as dynamic typing, which you really only appreciate if you’ve had to do advanced Object Oriented Programming in a static language before.


Python is a general purpose programming language, unlike something like SQL, which is solely for database work, or even R, which focuses exclusively on stats and data.

What this means is that once you’ve mastered the basics of Python, you can use it for a truly bewildering array of things:

  • Setting up a tiny web server
  • Building huge performance websites
  • Manipulating files on your hard drive or network
  • Automating IT admin tasks like changing directory permissions
  • Text and natural language processing
  • Scraping web pages for data
  • Any kind of database work
  • Manipulating spreadsheets, PDF files and other types
  • Robotics projects
  • Statistical analysis
  • Utility tools for productivity
  • Desktop applications
  • Games

I always encourage people who use Python for a specific niche purpose to explore alternative uses for their skills. Not only will you have fun learning something new (and maybe make something useful), but you’ll also be exposed to different libraries, written by different people, and therefore learn different approaches to organising code.

This is particularly true for people who use Python in a scientific or engineering context, as the code examples they usually work with are written by scientists for scientists, which often pay little regard to good coding practices.

What’s more is that if you get good at Python, it doesn’t take much to become really useful in another field, which can be a real asset in your workplace or further down in your career (you wouldn’t be the first scientist turned web developer because he/she learned Python!).

Speed up your own work

It always surprises me to see people with knowledge of Python perform long-winded or repetitive tasks on files, which a Python script could easily do for them.

While it’s true that you can automate tasks using a bash script, or batch file on Windows, it’s just a lot more pleasant using Python, especially if your task gets beyond even moderate complexity (besides, who remembers batch file syntax?)

Here’s a script to search for TV series on your hard drive from the command line and play the one you select:

import os, shutil
from collections import OrderedDict
def find_and_play(folder, search_string):
num = 1
choice = OrderedDict()
for a, b, c in os.walk(folder):
for i in c:
if search_string.lower() in i.lower():
location = os.path.join(a, i)
choice[num] = (i, location)
num += 1
for i in choice:
print”{0}: {1}”.format(i, choice[i][0])
userChoice = int(raw_input(‘Which do you want to watch?’))
film = choice[userChoice][1] os.startfile(film) #Open the file with Windows default programsearch_string = str(raw_input(“Search for:”))
find_and_play(“D:\\Media\\TV”, search_string)

The code is basic, and the application trivial, but it shows the kind of little time-savers you can make for tasks you repeat frequently.

What tasks could do you spend a few minutes doing every day that you could automate?

The Pythonic way

While Python itself doesn’t do anything to help you write better code (beyond de-cluttering your screen of all those curly braces you see in other languages) the culture surrounding Python is very much focused on writing “correct” code.

While some of this involves advanced concepts and design patterns which are common to most languages, there’s also a set of softer guidelines (mostly covered in PEP8) focusing on how you should write code in Pythonic style.

Pythonic style is all about readability, conciseness, and common sense. Following these guidelines and thinking about the logic behind them is a great starting point on your path to becoming a better programmer, and not just in Python.

These are just some of the reasons Python is the preferred language for many developers, and an increasing amount of schools and universities. There are many other perks, such as an interactive development environment, libraries for just about anything, a plethora of web frameworks, testing tools, and automation helpers, free IDEs, and all the online help you could ever need at stackoverflow.

So if you haven’t taken the plunge into the fantastic world of Python programming yet, now is the time.

Visit the Python course page for full details.