Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Variable length Sequence matching #11

Open
gvanrossum opened this issue Apr 12, 2020 · 2 comments
Open

Variable length Sequence matching #11

gvanrossum opened this issue Apr 12, 2020 · 2 comments
Labels
accepted Discussion leading to a final decision to include in the PEP fully pepped Issues that have been fully documented in the PEP

Comments

@gvanrossum
Copy link
Owner

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.

@viridia
Copy link
Collaborator

viridia commented May 19, 2020

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

@gvanrossum
Copy link
Owner Author

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 gvanrossum added the accepted Discussion leading to a final decision to include in the PEP label May 20, 2020
@viridia viridia added the fully pepped Issues that have been fully documented in the PEP label Jun 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted Discussion leading to a final decision to include in the PEP fully pepped Issues that have been fully documented in the PEP
Projects
None yet
Development

No branches or pull requests

2 participants