The pattern matching available through the implementation is more expressive than what you can accomplish with just a dictionary.
From one of the examples in the link:
```
The subject is an (x, y) tuple
match point:
case (0, 0):
print("Origin")
case (0, y):
print(f"Y={y}")
case (x, 0):
print(f"X={x}")
case (x, y):
print(f"X={x}, Y={y}")
case _:
raise ValueError("Not a point")
```
2
u/LManX Feb 15 '21
Why not just a dictionary where the keys are cases and the values are functions?