4

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")
Noa
  • 111
  • 1
  • 2
  • 6
  • 1
    The [docs](https://docs.python.org/3/library/__future__.html) don't seem to suggest you can. – fsimonjetz Apr 25 '22 at 11:25
  • 2
    `from __future__` is mostly about giving you a way to switch on a breaking change in advance. That doesn't apply to structural pattern matching, which doesn't change how any existing code should behave. – DavidW May 31 '22 at 21:18

0 Answers0