Skip to content

gh-103373: Improve documentation for __mro_entries__ #103374

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

Merged
merged 2 commits into from
Apr 8, 2023

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Apr 8, 2023

@AlexWaygood
Copy link
Member Author

AlexWaygood commented Apr 8, 2023

Docs preview link

@AlexWaygood AlexWaygood merged commit 0ba0ca0 into python:main Apr 8, 2023
@miss-islington
Copy link
Contributor

Thanks @AlexWaygood for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@AlexWaygood AlexWaygood deleted the document-mro-entries branch April 8, 2023 14:09
@bedevere-bot
Copy link

GH-103376 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 8, 2023
@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Apr 8, 2023
miss-islington added a commit that referenced this pull request Apr 8, 2023
(cherry picked from commit 0ba0ca0)

Co-authored-by: Alex Waygood <[email protected]>
:class:`type`, then an ``__mro_entries__`` method is searched on the base.
If an ``__mro_entries__`` method is found, the base is substituted with the
result of a call to ``__mro_entries__`` when creating the class.
The method is called with the original bases tuple, and must return a tuple
Copy link
Member

Choose a reason for hiding this comment

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

This was merged before I had a chance to review, but just to note for the future, the standard Python docs convention is to always italicize parameter names (*bases*), especially on first use.

Copy link
Member Author

@AlexWaygood AlexWaygood Apr 9, 2023

Choose a reason for hiding this comment

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

Thanks for the review! "The original bases tuple" here refers to the object that is passed to the parameter named bases rather than the word "bases" referring to the parameter named bases itself — so I don't think that convention applies here. But if this is confusing then maybe the sentence needs to be reworded — so this is useful feedback, thanks :)

I was planning on doing a followup PR anyway, adding links from other parts of the docs to this section in the data model. I'll see if I can address this as part of the followup PR.

Copy link
Member

@CAM-Gerlach CAM-Gerlach Apr 9, 2023

Choose a reason for hiding this comment

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

I see, thanks—I wasn't totally sure about that. In that case, then, it might be helpful, then, to explicitly mention the bases parameter somewhere relevant, particularly for readers scanning the docs looking for its description.

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.

5 participants