this post was submitted on 08 Jun 2025
513 points (97.4% liked)

Programmer Humor

36375 readers
20 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] sjmarf@sh.itjust.works 15 points 3 days ago (1 children)

Python does have a switch statement now, actually. And yes, they went out of their way to call it something different - match.

https://docs.python.org/3/tutorial/controlflow.html#match-statements

[–] NichtElias@sh.itjust.works 11 points 2 days ago (1 children)

match isn't just equivalent to switch though, so in this case it actually makes sense to call it something different.

[–] Archr@lemmy.world 1 points 6 hours ago

This is very true. Match statements are much more powerful that switch statements in any other language.

For instance:

  • matching objects very specifically
  • if conditions within case statements
  • pulling variables from inside of the object directly.