News for hackers. Stuff that matters.
Re:Pattern matching accepted for Python by cjohnson318 on Tuesday February 09, 2021 @05:28PM (#26083282)
I think str.format() was an improvement on from % formatting, and that the f strings are an improvement on str.format(). It's readable, concise, and it's familiar from other scripting languages.

I think the advantage of switch statments and pattern matching is that you know the scope of the thing you're switching or matching on, but you don't have that restriction in if/elif/else blocks. There's nothing keeping me from adding a condition like, `elif day == "Tuesday":`, that has nothing to do with the task at hand. When I see switch or match, I feel like I know what I'm getting into.

There are no comments on this comment yet.