PEP 636 -- Structural Pattern Matching: Tutorial | Python.org

PHOTO EMBED

Thu Dec 30 2021 06:47:22 GMT+0000 (Coordinated Universal Time)

Saved by @anirudhp2014

match command.split():
    case ["quit"]:
        print("Goodbye!")
        quit_game()
    case ["look"]:
        current_room.describe()
    case ["get", obj]:
        character.get(obj, current_room)
    case ["go", direction]:
        current_room = current_room.neighbor(direction)
    # The rest of your commands go here
content_copyCOPY

https://www.python.org/dev/peps/pep-0636/