How to do structural pattern matching in Python 3.10 with a type to match?
10:28 22 Jan 2022

I am trying to match a type in Python 3.10 using the console:

t = 12.0
match type(t):
  case int:
    print("int")
  case float:
    print("float")

And I get this error:

  File "", line 2
SyntaxError: name capture 'int' makes remaining patterns unreachable

How can I fix this issue?

python python-typing python-3.10 structural-pattern-matching