Skip to content
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

bpo-46290: Fix parameter names in dataclasses docs #30450

Merged
merged 5 commits into from
Jan 8, 2022

Conversation

zsol
Copy link
Contributor

@zsol zsol commented Jan 7, 2022

Fix documentation typos in parameter names for dataclasses API.
These are important to avoid confusion when passing in arguments as keywords, like in Instagram/LibCST#585 (comment)

https://bugs.python.org/issue46290

@zsol zsol requested a review from ericvsmith as a code owner January 7, 2022 10:19
@bedevere-bot bedevere-bot added docs Documentation in the Doc dir awaiting review labels Jan 7, 2022
@zsol zsol changed the title Fix parameter names in dataclasses docs [bpo-46290] Fix parameter names in dataclasses docs Jan 7, 2022
@zsol zsol changed the title [bpo-46290] Fix parameter names in dataclasses docs bpo-46290: Fix parameter names in dataclasses docs Jan 7, 2022
@AlexWaygood AlexWaygood added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes labels Jan 7, 2022
…KZFmh.rst

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
@@ -406,10 +406,10 @@ Module contents
def add_one(self):
return self.x + 1

.. function:: replace(instance, /, **changes)
.. function:: replace(obj, /, **changes)
Copy link
Member

Choose a reason for hiding this comment

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

FTR the slash marks the arguments before it as positional-only, so the name chosen does not matter as it does not apply to code, it’s only for readers of the doc. (But if all other instances are changed, it makes sense to change this one too.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this is more for consistency than anything else.

Copy link
Contributor

@taleinat taleinat Jan 8, 2022

Choose a reason for hiding this comment

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

The first argument for the other functions, asdict(), astuple(), and isdataclass(), is not positional-only. So changing the argument name is indeed a meaningful fix that should be made. In that context, indeed changing the name for replace() for consistency makes sense.

@taleinat
Copy link
Contributor

taleinat commented Jan 8, 2022

Something the NEWS check doesn't know is that we don't add NEWS entries for documentation-only fixes. I'm adding the appropriate label to this PR and removing the NEWS entry.

@zsol
Copy link
Contributor Author

zsol commented Jan 8, 2022

Thanks! I saw somewhere that minor typo changes generally don't need a NEWS entry but when the CI check failed I wasn't sure if I read outdated info or the CI check is wrong :)

@taleinat taleinat merged commit ef5376e into python:main Jan 8, 2022
@miss-islington
Copy link
Contributor

Thanks @zsol for the PR, and @taleinat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 8, 2022
(cherry picked from commit ef5376e)

Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
@bedevere-bot
Copy link

GH-30482 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Jan 8, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 8, 2022
(cherry picked from commit ef5376e)

Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Jan 8, 2022
@bedevere-bot
Copy link

GH-30483 is a backport of this pull request to the 3.9 branch.

@taleinat
Copy link
Contributor

taleinat commented Jan 8, 2022

Thanks for the PR, @zsol!

@zsol zsol deleted the dataclasses-docs branch January 8, 2022 10:57
miss-islington added a commit that referenced this pull request Jan 8, 2022
(cherry picked from commit ef5376e)

Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
miss-islington added a commit that referenced this pull request Jan 8, 2022
(cherry picked from commit ef5376e)

Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants