4 Respostas
+ 1
Ankith M Kashyap
It's not written that way, so it's not included in the language's syntax.
Look at it this way: each programming language has something the other ones doesn't have. This is the beauty of it 😃😃
+ 1
In Python the if/elif/else statement, use of dictionary dispatch, custom functions, etc. performs the same as switch/case. The Python community has also rejected the implementation of switch/case every time the idea is mentioned...
"A quick poll during my keynote presentation at PyCon 2007 shows this proposal has no popular support. I therefore reject it."
https://www.python.org/dev/peps/pep-3103/#if-elif-chain-vs-dict-based-dispatch
+ 1
Thanks sir Steven M
0
And I have also read some posts which tells us to create our own snippets for making use of switch like function in python?! But it doesn't tell about why it doesn't have a switch case !?!