Sign in

A lunchtime story to demonstrate threading, asyncio, multiprocessing & cloud functions

Photo by amirali mirhashemian on Unsplash


I’m going to tell a story to explain the different concurrency and parallelism options in Python.

In this story we will see how a single person multitasking is like concurrency, and multiple people doing their own tasks is like parallelism. We’ll watch these scenarios in action at some well known lunchtime restaurants as they quickly and efficiently serve their customers. Then I’ll implement these restaurants in Python, and finally I’ll compare the different concurrency options and explain when to use each one.

I’ll explain:

  • What the difference is between…

Photo by Martin Adams on Unsplash

When starting a new Python project, it is tempting to just dive in and start coding. Spending a tiny amount of time to set up a project with the best tools will save immense time and lead to a happier coding experience.

In an ideal world, dependencies would be identical for all developers, code would be perfectly formatted, common errors forbidden and everything would be covered by tests. Additionally, all of these would be ensured at each commit.

In this article, I’ll go through how to set up a project that does exactly that. You can either follow along with…

Instant refactoring of code

Refactoring is the process of improving the quality of code without changing what it does. Taking a little bit of time to refactor your code before committing it can make it much more readable, which makes it easier to maintain. Doing this consistently turns finding bugs and adding new features from a nightmarish hellscape into a walk in the park.

Ideally your code will be fully covered with unit tests, allowing you to make changes with confidence. If it isn’t then you should add tests before starting to refactor if at all possible. …


Helping Python developers write higher quality code. See how ->

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store