Structural Pattern Matching (PEP 634) in Python

Structural Pattern Matching (PEP 634) in Python

Ankit Mahato's photo
Ankit Mahato

Published on Feb 9, 2021

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Earlier today, the Python Steering Council announced the acceptance of PEP 634, and its companion PEPs 635 and 636, collectively known as the Pattern Matching PEPs.

This will lead to the introduction of match statement in future version of Python which can be considered as a powerful version of switch statement available in traditional programming languages.

During the pattern matching process, an input subject value will be matched against specified patterns. Check out some code examples below:

Anthony Shaw's Tweet

Thomas J. Fan's Tweet

Some more structural pattern matching examples by Guido van Rossum

You can read the complete details of the PEP here:

Share this