Language Syntax

Pattern value — Python syntax

Compare the subject for equality with a dotted value lookup. A bare identifier would capture instead. Implementations may cache repeated value lookups during one execution of a match statement.

Formal Syntax & Structure

python syntaxpython
case Namespace.CONSTANT: suite

Working Example

Example Snippetpython
class State:    READY=2match 2:    case State.READY:        result='ready'    case _:        result='other'print(result)
Python Reference