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

Document special meaning of ... in overloads #10772

Merged
merged 4 commits into from
Jul 7, 2021

Conversation

antonagestam
Copy link
Contributor

Description

This PR documents the special meaning of ellipses for default values in overloads. The only reference I could find to this behavior in non-code writing is this comment by @Michael0x2a.

If you think it's inaccurate that this is (or should be) a best practice I'll rephrase that sentence, but it's my impression that it is.

Test Plan

The change renders like this locally (make html):

Copy link
Collaborator

@TH3CHARLie TH3CHARLie left a comment

Choose a reason for hiding this comment

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

Looks good, I like this.

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

To my understanding, the value of the default value never matters. "Sometimes" and "best practice" are weaselly words here: when and why? I think I'd phrase this as:

The actual value for the default value of an argument doesn't affect the signature, only the presence or absence of a default value does. Therefore to reduce redundancy, you can elide the default value, replacing it with the ... placeholder. For example:

@antonagestam
Copy link
Contributor Author

@hauntsaninja Good point, I'll rephrase the paragraph 👍

@antonagestam
Copy link
Contributor Author

@hauntsaninja I worked on the phrasing, let me know what you think 🙂

@hauntsaninja
Copy link
Collaborator

Looks great! Thanks for improving the docs!

@hauntsaninja hauntsaninja merged commit cdb2685 into python:master Jul 7, 2021
@antonagestam antonagestam deleted the document-overload-ellipses branch July 7, 2021 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants