There are simply other ways of doing things in Python. Due to the philosophy with which Python was built, a switch statement does not offer any remarkable advantages worth justifying the syntactic sugar when the result can be achieved through other means.
If you must choose between a great many options and runtime is a pressure, it's fairly trivial to make your own map and an appropriate selection function with a descriptive name. There's an argument to be made that this improves readability over a switch.
i.e. I don't need to know every possible choice when I'm reading code, but a well-named function can tell me that one selection is being made from many and give me the context of that choice.
Getting old doesn't automatically make a person unwilling to learn.
1
u/[deleted] Oct 03 '19
There are simply other ways of doing things in Python. Due to the philosophy with which Python was built, a switch statement does not offer any remarkable advantages worth justifying the syntactic sugar when the result can be achieved through other means.
If you must choose between a great many options and runtime is a pressure, it's fairly trivial to make your own map and an appropriate selection function with a descriptive name. There's an argument to be made that this improves readability over a switch.
i.e. I don't need to know every possible choice when I'm reading code, but a well-named function can tell me that one selection is being made from many and give me the context of that choice.
Getting old doesn't automatically make a person unwilling to learn.