Live Feed/Python/Fact Record
Python logo
Python
feature 96% Confidence Gate August 25, 2026

PEP 845: Leading-Dot Value Patterns

PEP 845 introduces a new syntax allowing local and global variables to be used as value patterns in match statements via a leading-dot prefix. This eliminates the requirement for guard clauses when matching against non-attribute names.

Verified State Diff

Comparison Mode:
- Previous State
Match statements could only use attribute names as value patterns, requiring guard clauses to compare subjects against local or global variables.
+ Verified New State
Match statements support leading-dot syntax (e.g., .variable_name) to perform equality comparisons against local and global variables directly.

Impact & Verification Analysis

WHO IS AFFECTED

Python developers utilizing structural pattern matching in Python 3.x.

WHY IT MATTERS

It simplifies code readability and reduces the reliance on verbose guard clauses, making pattern matching more idiomatic for standard variable comparisons.

Full Fact Overview

The implementation of PEP 845 modifies the Python pattern matching mechanism to resolve names prefixed with a dot (.) using standard scope resolution rules rather than treating them as capture patterns. Previously, match statements required either attribute access (e.g., Module.CONSTANT) or guard clauses (if x == local_var) to compare a subject against a variable defined in the current scope. By enabling '.name' syntax, the language reduces boilerplate code and improves the ergonomics of structural pattern matching for complex conditional logic.

Multi-Source Evidence Chain (1)

PEP 845: Leading-Dot Value PatternsPython
TRACKED ENTITY
Explore all historical Python changes
View Python Hub ➔