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

[doc] Teach 0-args form of super in Programming FAQ #22176

Merged
merged 5 commits into from
Sep 20, 2020

Conversation

andresdelfino
Copy link
Contributor

Teach simpler and more maintainable use of super.

@bedevere-bot bedevere-bot added docs Documentation in the Doc dir awaiting review labels Sep 9, 2020
@andresdelfino andresdelfino changed the title [doc] Teach 0-args form of super in Programming HOWTO [doc] Teach 0-args form of super in Programming FAQ Sep 9, 2020
@rhettinger
Copy link
Contributor

This change looks good.

While you're at it, the rest of the entry can be fixed up. In the title, replace "override" with "extend". Also the text paragraph that follows needs to be revised.

@andresdelfino
Copy link
Contributor Author

andresdelfino commented Sep 18, 2020

@rhettinger had doubts about removing the mention to classic classes, you think that's alright? OtherwIse, I'm not sure what you meant by revising the folllowing paragraph, sorry.

@andresdelfino
Copy link
Contributor Author

andresdelfino commented Sep 18, 2020

If you are talking about the next question ("How can I organize my code to make it easier to change the base class?
"), this PR deals with it: #22177

@rhettinger
Copy link
Contributor

I would remove the entire paragraph that starts with "For version prior to 3.0, you may be using classic classes". That is no longer relevant.

Perhaps replace the paragraph with an explanation of what the zero-arg form of super() is actually doing. It figures out the self argument which it uses to derive the MRO. Then it figures out that the current class is Derived and uses that information to determine where in the MRO to start seaching.

@andresdelfino
Copy link
Contributor Author

@rhettinger I have made the suggested changes

Doc/faq/programming.rst Outdated Show resolved Hide resolved
@rhettinger rhettinger merged commit 778ad92 into python:master Sep 20, 2020
@andresdelfino andresdelfino deleted the use_simpler_super branch September 20, 2020 17:20
xzy3 pushed a commit to xzy3/cpython that referenced this pull request Oct 18, 2020
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 issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants