Re:What Is the Switch-Case Equivalent in Python?
by oblvious-earth on Thursday April 08, 2021 @02:43PM
(#26742251)
That's not an existing construct, it's a LHS assignment language like the match statement but it's embedded inside a for-loop.
Which means you have to implement all the grammar of the current match and it restricts to only works on iterables.
How would you implement this for an object that isn't iterable?
E.g., pattern matching of this sort
IMO should have "just worked".But now we have two different and incompatible versions of pattern matching in Python.