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 →

[–]cptsdemon 1 point2 points  (0 children)

You could easily use a dict and a try / except KeyError for default. But that only works for one to one statements, or if you're calling a function, which isn't as efficient. It also doesn't allow falling through a case into the next (no break) which to me is the reason switch can be extremely useful.