Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
IMO switch serves no real purpose other than syntax sugar. Not actually needed.
-
htlr52077yI was even more terrified to know there aint no ++ in python 😢 how do guys live without it?
-
the rejection notice at
https://python.org/dev/peps/...
shows there was no popular support for it at some conference -
elazar10307y@TheCapeGreek it is useful when you are using enums or sum-types, since the syntactic sugar makes it easier for the compiler to warn you about missing cases.
As a contributor to mypy I would love Python to have a switch, but there is no obvious syntax for it. -
th3113397y@TheCapeGreek That isn't an opinion, it's a fact. A pointless one to state, but a fact.
It's pointless because most of every language is syntactic sugar, that doesn't mean you can't complain about extremely common and useful bits of sugar that some languages don't have for no immediately evident reason. -
@roh-7 because of PEP 20.
https://python.org/dev/peps/...
Especially
"Special cases aren't special enough to break the rules."
and
"There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch."
Related Rants
No switch () in python! Wtf!
rant
python3