Structural pattern matching in python <3.10

955 Views Asked by At

To use the | operator in <3.10, one can do from __future__ import annotations. Is something similar possible for structural pattern matching, i.e. writing things like

match x:
    case 1:
        print("x is 1")
    case 2:
        print("x is 2")
0

There are 0 best solutions below