bestelbus22@lemmy.world to Programmer Humor@lemmy.mlEnglish · 1 year agoThe meaning of thislemmy.mlimagemessage-square71fedilinkarrow-up1549arrow-down114
arrow-up1535arrow-down1imageThe meaning of thislemmy.mlbestelbus22@lemmy.world to Programmer Humor@lemmy.mlEnglish · 1 year agomessage-square71fedilink
minus-squareSjmarf@sh.itjust.workslinkfedilinkEnglisharrow-up19arrow-down2·1 year 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-squareNichtElias@sh.itjust.workslinkfedilinkarrow-up11·1 year agomatch isn’t just equivalent to switch though, so in this case it actually makes sense to call it something different.
minus-squareArchr@lemmy.worldlinkfedilinkarrow-up1·1 year 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
switchstatement 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
matchisn’t just equivalent toswitchthough, 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: