Contribute Media
A thank you to everyone who makes this possible: Read More

Patterns and Anti-patterns in Python's Structural Pattern Matching

Description

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.

Details

Improve this page