patma icon indicating copy to clipboard operation
patma copied to clipboard

Variable length Sequence matching

Open gvanrossum opened this issue 5 years ago • 2 comments

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.

gvanrossum avatar Apr 12 '20 06:04 gvanrossum

If we are following the destructuring syntax, then [a, b, *_] should allow you to ignore/skip the remaining values.

viridia avatar May 19 '20 04:05 viridia

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'.

gvanrossum avatar May 20 '20 04:05 gvanrossum