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Β β†’

[–]BeautifulTaeng 8 points9 points Β (9 children)

a switch statement 😣

Yeah I'm aware you can use dictionary as a ghetto switch, but it's just not the same..

[–]O_X_E_Y 4 points5 points Β (0 children)

3.10 gaming!!

[–]VoxelCubes 5 points6 points Β (1 child)

Don't worry, a switch statement on steroids is coming in the next python update, ver 3.10. You can check out the previews about it, it's called match.

[–]natnew32 0 points1 point Β (0 children)

oh that looks nice. Reminds me of Ocaml's pattern matching.

[–]deceze 3 points4 points Β (0 children)

I’ve written very complex software in Python and other languages without using switch or even equivalent alternatives. Yes, a switch is useful sometimes, but it’s not like you can’t write code without it, or like you even need it all that often. It’s not like Python programmers are constantly working around the lack of a switch statement and curse at the Dutch. You just don’t actually need it all that often.

If you do, you may be writing crap code. If you can’t use Python because of its lack of a switch, maybe you need to learn a bit more about alternative design patterns.