what y’all are missing about switch/case is that it’s not necessarily a series of comparisons in most languages.

in essence, it’s a hashmap lookup with (in some languages) optional comparisons.

in python, the most similar thing is something like this:

def branch_2_3():
    spam(1)
    spam(6)

{
    'key1': lambda: eggs += lay_eggs(), #branch 1
    'key2': branch_2_3,
    'key3': branch_2_3,
}[value]()

which is of course completely ugly and unnecessarily complicated for cases where multiple keys lead to the same branch.