-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
gh-87209: Clarify ordering rule for default arguments in tutorial #138529
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
base: main
Are you sure you want to change the base?
Conversation
ede58ce
to
52a3ae5
Compare
Doc/tutorial/controlflow.rst
Outdated
@@ -588,8 +588,9 @@ Default Argument Values | |||
----------------------- | |||
|
|||
The most useful form is to specify a default value for one or more arguments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most useful form is to specify a default value for one or more arguments. | |
The most useful form is to specify a default value for one or more parameters. |
This is talking about parameters, not arguments.
Doc/tutorial/controlflow.rst
Outdated
All arguments without default values must come first, followed by those with | ||
defaults. This allows a function to be called with fewer arguments than it is | ||
defined to allow. For example:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All arguments without default values must come first, followed by those with | |
defaults. This allows a function to be called with fewer arguments than it is | |
defined to allow. For example:: | |
All positional only parameters (that is, without default values) must come first, followed by those with | |
defaults. This allows a function to be called with fewer arguments than it is | |
defined to allow. For example:: |
I think we should be introducing the proper terminology?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, good point. I'll update this section to use parameters consistently since that's the proper terminology in this context. Appreciate the clarification!
52a3ae5
to
a323351
Compare
Hi @StanFromIreland, I’ve updated the body to use parameters consistently. Let me know if you spot anything else. Thanks! |
Doc/tutorial/controlflow.rst
Outdated
The most useful form is to specify a default value for one or more parameters. | ||
All positional only parameters (that is, without default values) must come first, followed by those with | ||
defaults. This allows a function to be called with fewer arguments than it is | ||
defined to allow. For example:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please ensure all lines are wrapped to 79 characters.
a323351
to
0c595ce
Compare
Hi @StanFromIreland, I’ve updated the section so that all lines are wrapped at 79 characters as requested. Please let me know if there’s anything else I should adjust. Thanks! |
This PR updates section 4.9.1 of the tutorial to clarify that arguments without default values must come before arguments with default values.
Current text:
Proposed text:
Closes gh-87209.
📚 Documentation preview 📚: https://cpython-previews--138529.org.readthedocs.build/