Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add __match_args__ to support match case destructuring in Python 3.10 #815
Add __match_args__ to support match case destructuring in Python 3.10 #815
Changes from 9 commits
452b09a
530e85f
9d8b441
e13c92d
69d0928
918c1b4
4c0a339
1c246db
a2afba6
590e31e
69bfe66
753811b
b9d6b60
778d296
0cd51b4
3793bcd
075db99
a0f426d
db4fc7d
e3a8036
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
_has_own_attribute
for the second check.I'm aware that the implementation is currently obtuse and depending on how Larry's typing proposal will go, we'll fix it centrally eventually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This behavior is also somewhat inconsistent with the rest of
attrs
, where we overwrite unlessauto_detect
is set to True (default in new APIs). Is this the behavior of dataclasses?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also doesn't make sense to add it on Pythons older than 3.10, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the initial implementation of the pattern matching PEP there was no flag to disable
__match_args__
generation but there was a request raised later on a flag to opt-out though__match_args__ = ()
being set manually was proposed. Discussion : https://bugs.python.org/issue43764