patma
patma copied to clipboard
Variable length Sequence matching
The obvious syntax for this would be case [a, b, *rest] or even case [a, b, *rest, y, z]. Here rest would always receive a list, similar to how tuple unpacking works.
If we are following the destructuring syntax, then [a, b, *_] should allow you to ignore/skip the remaining values.
The PEP has this. I was reluctant to add it because in my simplistic implementation (patma.py) it would be somewhat complicated, but I accept that it's useful and I don't think anybody would object, so marking as 'accepted'.