Python: `match` for structured branching (3.10+)
pythonpatterns
Pattern matching can simplify nested if/elif.
def f(x):
match x:
case 0: return 'zero'
case _: return 'other'
print(f(0)) Pattern matching can simplify nested if/elif.
def f(x):
match x:
case 0: return 'zero'
case _: return 'other'
print(f(0))