PyCharm
 
Get PyCharm

Pattern matching

Last modified: 11 February 2024

PyCharm provides support for pattern matching introduced in PEP-634, PEP-635, and PEP-636 and available since Python 3.10.

Pattern matching has been added in the form of a match statement and case statements of patterns with associated actions:

Patterns consist of sequences, mappings, primitive data types, and class instances. Pattern matching allows extracting information from complex data types, branch on the structure of data, and apply specific actions based on different forms of data. For more information about examples and use cases, refer to the feature overview at docs.python.org and PEP-636 (tutorial).

PyCharm provide the following coding assistance for pattern matching: