PyBeach 2025

Brett Slatkin

Brett Slatkin is the author of the book Effective Python and has been writing Python code professionally for the past 20 years. He works as a principal software engineer in the Office of the CTO at Google, developing technology strategies and rapid prototypes. His experience includes: founding Google Surveys (a platform for collecting machine learning and market research datasets), launching Google App Engine (the company's first cloud computing product), scaling Google's A/B experimentation products to billions of users, and co-creating PubSubHubbub (the W3C standard for real-time RSS feeds). He earned his B.S. in Computer Engineering from Columbia University in the City of New York.


Social Media Handle (Twitter, LinkedIn, Mastodon):

https://x.com/haxor


Session

09-27
11:00
25min
Patterns and Anti-patterns in Python's Structural Pattern Matching
Brett Slatkin

Have you used Python's match statement? How do you decide when to use match instead of a typical if/elif/else statement? Although structural pattern matching functionality has been available in Python for years, many Python developers still aren't sure about the best way to employ match in their own programs.

This talk will explore effective patterns that work well with the new match statement, and common pitfalls to avoid. It will highlight when if/elif/else constructs are a better fit, and how to judge when it's time to consider moving from one style to another. The talk will also cover other approaches to matching patterns, including look-up tables for performance and unpacking for sequences.

After attending this talk, you'll be able to confidently use the match statement to enhance your programs and discern when match will harm the readability of your code.

Venue