Race Conditions

Notes on Interviewing for Python Developer Roles

A few months ago, I opened my Twitter DMs for questions about tech interviews for Python developer roles. I received lots of great questions from junior developers looking for their first software engineering role and from more experienced developers looking to make a change to Python development. Because there seems to be sufficient interest in interviewing for Python dev roles, I’ve decided to compile the notes that I’ve taken over my four years of interviewing for Python developer roles and publish them here for the benefit of anyone applying or thinking of applying for a Python developer job.

As usual, the standard disclaimer for advice applies: my experience is limited to the UK and London in particular and has been mostly confined to junior-to-midlevel developer roles in finance, fintech, machine learning and e-commerce. The notes I’ve taken most certainly reflect the hiring quirks of these particular industries and location and might not be applicable for every situation. If you are applying for a role and are not sure what to expect from the interview, don’t hesitate to ask your recruiter about the interview format. At least at larger companies, they will usually be able to tell you a bit about what to expect (ie. ‘classical’ tech interview, pair programming exercise, presentation etc). If you have any specific questions about working as a junior-to-mid level Python developer, I am also more than happy to help. My contact information can be found here.

Python in the industry

Before we dive into the type of questions you might be asked in a Python developer interview, I wanted to give a brief overview of the kinds of Python-based technologies that I’ve encountered in my years working in the industry. Usually, they can roughly be divided into four categories: e-commerce and web applications developed using Django or Flask, gluecode layers for deploying and maintaining infrastructure, data processing pipelines that read data from one data store and write it into another and large scale financial application ecosystems (the likes of Athena at JP Morgan and Quartz at Bank of America Merril Lynch). Although you will almost certainly encounter questions about core Python topics, it’s also likely that each industry and each tech stack that you are interviewing for might have its own set of extra questions. For example, for roles where you will be using Python to construct data processing pipelines, you might be asked about databases and ORMs.

Technical Topics

I’ve grouped the technical topics that have frequently come up in Python interviews into subsections for easier navigation. I’ve completely left out traditional topics that crop up in the classical whiteboarding interviews: the thousands of variations on linked lists, trees and so forth. While important for one purpose or another and certainly relatively frequently seen in interviews, I’ve decided to leave them out, because they have been covered elsewhere by more experienced writers.

Object oriented programming

  • Key concepts in OOP: be able to explain inheritance, polymorphism, encapsulation
  • Difference between new style and old style Python classes
  • Multiple inheritance and method resolution order
  • Practical exercises where you are given a subclass inheriting from multiple superclasses and asked to resolve a method call
  • Difference between overriding and overloading
  • OOP and design: Is Python good for OOP projects? Why or why not? If you’ve used another OOP heavy language such as Java, you can compare and contrast the features offered by Java to those offered by Python.

Python’s built-in data structures

  • Discuss the difference between mutable and immutable data structures and give an example of each
  • Knowledge of how Python dictionaries work internally
  • Are strings mutable or immutable? What consequences does this have in for-loops that append to a string?

Pythonic features

  • Writing and reading comprehensions (list, dict, set)
  • Being able to explain when and why it is good to use a list comprehension instead of constructing a list with for-loops and call to .append for example.
  • Writing and reading generator functions and giving reasons when and why to use them
  • Writing co-routines using generator functions’ yield syntax
  • Understanding context managers and when to use them
  • Understanding and writing decorators

Functional programming with Python

Functional programming styles come up very rarely in Python interviews, perhaps because unlike Clojure, Python is not very opinionated about which programming paradigm to go for. In any case, once or twice I have been asked about the following: - anonymous functions/lambda functions - filter, map, reduce and give and an example of using each

Miscellaneous

As warm-up or conclusion questions, you might also be asked about your experience in other programming languages (for example, Java ) and how this compares to Python. In these cases, it’s usually helpful to know a bit about how the most common implementation of Python (CPython) works under the hood.