Pattern Matching in Python

Learning why Python and patterns are a perfect match

Daniel Moisset

CPython Functional Programming New Features Python general

See in schedule: Thu, Jul 29, 13:15-13:45 CEST (30 min) Download/View Slides

When Python 3.10 comes out in October 2021, it will include a new feature called “Structural Pattern Matching”. Structural Pattern Matching has been a staple of functional programming languages, but it has recently appeared or been proposed as future additions to imperative and OOP programming languages (like JavaScript, C++, and Rust). It provides an elegant way of processing and deconstructing heterogeneous data structures, and it enables an alternative paradigm to method dispatch.

As one of this feature's contributors, my goals in this presentation are to describe the motivation for this new functionality, present some of the problems that its use will effectively solve, and give a brief introduction of how to use it.

This talk is aimed at intermediate Python developers (although a beginner will be able to understand it). After attending you should be able to understand not just how to use pattern matching, but also when it’s a good idea to use it and what are the possible pitfalls to avoid.

There will be a Q&A session which could be a good chance to discuss your questions about why certain design decisions were made when introducing pattern matching into Python

Type: Talk (30 mins); Python level: Intermediate; Domain level: Beginner


Daniel Moisset

Bloomberg LP

I'm a Latin American expat in London. After 20ys of background as an entrepreneur, software engineer and project leader, I'm currently training engineers. Most of my professional career has been marked by a love for Python and good engineering. I'm deeply interested in compiler and language design, and places were CS theory and engineering practice touch each other closely.

Non professionally, I'm a bad piano player, a husband a Dungeon Master, and a cat herder. Preferred pronouns are he/him.