python3
Pattern Matching
Python added pattern matching, which works like this:Pattern matching became available in Python 3.10
match my_list:
case []:
print("empty list")
case [item]:
print(item)
case [*items]:
print(items)
case _:
print("default case")