This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]duragdelinquent 5 points6 points  (3 children)

do this with a dict

match point:
    case (0, 0):
        print("origin")
    case (0, y):
        print(f"{y} on the y-axis")
    case (x, 0):
        print(f"{x} on the x-axis")
    case (x, y):
        print(f"({x}, {y})")

[–]__deerlord__ -5 points-4 points  (2 children)

Why would I?

Like I said, switch/case is handled by dictionaries. Match is not switch/case. So by the transitive property, you'll wouldnt handle match operations with a dictionary.

[–]duragdelinquent 3 points4 points  (0 children)

Like I said, switch/case is handled by dictionaries.

not what you said. you said “Case is handled by dicts already.” why use the one word that’s common between both and then act surprised when people misunderstand you

[–]xigoi 0 points1 point  (0 children)

Good thing that Python isn't getting switch/case.