-
-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support match case destructuring in Python 3.10 using __match_args__ #814
Labels
Comments
An implementation with tests : tirkarthi@452b09a |
@tirkarthi Thanks for working on this. I suspect that a PR would be welcome here. |
10 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Python 3.10 match/case syntax was added that also has destructuring syntax. dataclass supports this feature and has option to disable this. The current logic is at https://github.com/python/cpython/blob/366c69f3f63a2a1cce57dabe8f7c2e67d1df625d/Lib/dataclasses.py#L374 where init and kw_only are checked.
dataclass had some discussion and added support where
__match_args__
generation can be disabled if needed : https://bugs.python.org/issue43764I have a patch locally working. I can write some tests. But I will be happy to know if a PR is accepted and if an option to disable matching is needed like dataclasses.
attrs
Dataclasses
The text was updated successfully, but these errors were encountered: