@[email protected] to Programmer [email protected]English • 8 days agoThe meaning of thislemmy.mlimagemessage-square67fedilinkarrow-up1519arrow-down114
arrow-up1505arrow-down1imageThe meaning of thislemmy.ml@[email protected] to Programmer [email protected]English • 8 days agomessage-square67fedilink
minus-squareSjmarflinkfedilinkEnglish16•8 days agoPython does have a switch statement now, actually. And yes, they went out of their way to call it something different - match. https://docs.python.org/3/tutorial/controlflow.html#match-statements
minus-square@[email protected]linkfedilink10•8 days agomatch isn’t just equivalent to switch though, so in this case it actually makes sense to call it something different.
minus-square@[email protected]linkfedilink1•5 days agoThis is very true. Match statements are much more powerful that switch statements in any other language. For instance: matching objects very specifically if conditions within case statements pulling variables from inside of the object directly.
Python does have a
switch
statement now, actually. And yes, they went out of their way to call it something different -match
.https://docs.python.org/3/tutorial/controlflow.html#match-statements
match
isn’t just equivalent toswitch
though, so in this case it actually makes sense to call it something different.This is very true. Match statements are much more powerful that switch statements in any other language.
For instance: