Improve dataclass docstring#94686
Conversation
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
My guess is that this is too small for NEWS, but I'm happy to add it if necessary. |
| kw_only=False, slots=False, weakref_slot=False): | ||
| """Returns the same class as was passed in, with dunder methods | ||
| added based on the fields defined in the class. | ||
| """Return the same class as was passed in, with dunder methods added |
There was a problem hiding this comment.
It's actually no longer true that the same class is returned (in the case of slots=True). I'm not sure of the exact wording that should be used. Otherwise looks good.
There was a problem hiding this comment.
Now that I think about it more, I think we should just drop "Return the same class as was passed in", and say "Add dunder methods based on ...".
Agreed. |
| assigned to after instance creation. If match_args is true, the | ||
| __match_args__ tuple is added. If kw_only is true, then by default | ||
| all fields are keyword-only. If slots is true, a __slots__ attribute | ||
| is added. |
There was a problem hiding this comment.
Here is where it should say that if slots is true, a new class is returned.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
I have made the requested changes; please review again. |
|
Thanks for making the requested changes! @ericvsmith: please review the changes made to this pull request. |
|
I will commit once @TomFryers has signed the CLA. edit: Hmm, now it's showing as signed (which it wasn't a minute ago). I'll commit once the tests have passed. |
|
Thanks @TomFryers for the PR, and @ericvsmith for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
|
Sorry, @TomFryers and @ericvsmith, I could not cleanly backport this to |
|
GH-94716 is a backport of this pull request to the 3.11 branch. |
(cherry picked from commit a10cf2f) Co-authored-by: Tom Fryers <61272761+TomFryers@users.noreply.github.com>
(cherry picked from commit a10cf2f) Co-authored-by: Tom Fryers <61272761+TomFryers@users.noreply.github.com>
This fixes three trivial issues: