Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add examples forrepr=... usage indataclasses.rst#123118

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
egorsmth wants to merge19 commits intopython:main
base:main
Choose a base branch
Loading
fromegorsmth:patch-1

Conversation

egorsmth
Copy link

@egorsmthegorsmth commentedAug 18, 2024
edited
Loading

Added additional example on how to exclude field from__repr__.

When I opened docs to read about@dataclass It seems non obvious how to exclude field from generated__repr__. So it seems an example is needed here.


📚 Documentation preview 📚:https://cpython-previews--123118.org.readthedocs.build/

Add additional example on how to exclude field from __repr__
@ghost
Copy link

ghost commentedAug 18, 2024
edited by ghost
Loading

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-appbedevere-appbot added docsDocumentation in the Doc dir skip news awaiting review labelsAug 18, 2024
@picnixzpicnixz changed the titlegh: Add example to dataclasses.rstAdd examples forrepr=... usage indataclasses.rstAug 18, 2024
review based edits:- format to doctest- additional example with repr=False in annotation
@egorsmthegorsmth marked this pull request as draftAugust 18, 2024 09:15
remove default values from example
try to fix identation problem
add import to doctest
try fix not found import
remove trailing spaces
@egorsmthegorsmth marked this pull request as ready for reviewAugust 18, 2024 11:23
@egorsmthegorsmth requested a review frompicnixzAugust 18, 2024 11:24
Copy link
Member

@picnixzpicnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Some changes still need to be done.

Copy link
Member

@picnixzpicnixz left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This should be the last round of nitpicking comments (I'll be offline for the rest of the day, so I'll leave the rest to a core dev, e.g., whether we need another example). Documentation PRs are always hard when there are examples because we need to find good ones. Thanks for keeping up with my demands!

egorsmth reacted with thumbs up emoji
egorsmthand others added2 commitsAugust 18, 2024 18:05
format first exampleCo-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
format second exampleCo-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@egorsmthegorsmth marked this pull request as ready for reviewAugust 18, 2024 16:08
@ericvsmith
Copy link
Member

I'm torn. Why only examples forrepr? Yet if we add examples for every parameter, then I think it will get too long. Do the examples really add anything that the prose does not make clear?

@egorsmth
Copy link
Author

egorsmth commentedAug 19, 2024
edited
Loading

@ericvsmith Hi!

Why only examples for repr?

I edited what I was stumble upon and to edit all doc seems will consume a lot of time. If you think that doc will become too long with similar examples for other parameters, then better to close this PR.

Do the examples really add anything that the prose does not make clear?

May be this is subjective, but yes, for me.

@picnixz
Copy link
Member

Personally, I wouldn't mind having examples for each parameter, though not on the same page. Theenum docs have multiple pages where there are more or less advanced examples. Maybe we could consider doing the same for dataclasses?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@picnixzpicnixzpicnixz approved these changes

@ericvsmithericvsmithAwaiting requested review from ericvsmithericvsmith is a code owner

Assignees
No one assigned
Projects
Status: Todo
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@egorsmth@ericvsmith@picnixz

[8]ページ先頭

©2009-2025 Movatter.jp