Skip to content

bpo-47054: Call params parameters not arguments in SyntaxErrors. #32014

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gpshead
Copy link
Member

@gpshead gpshead commented Mar 20, 2022

A couple of SyntaxErrors were potentionally confusing in their wording
due to the use of the term arguments when what it was referring are
pedantically parameters as the errors happen at definition time.

We unfortunately use the terms loosely in various parts of Python.

https://stackoverflow.com/questions/156767/whats-the-difference-between-an-argument-and-a-parameter#:~:text=A%20parameter%20is%20the%20variable,function%20when%20it%20is%20called.

https://bugs.python.org/issue47054

A couple of SyntaxErrors were potentionally confusing in their wording
due to the use of the term arguments when what it was referring are
pedantically parameters as the errors happen at definition time.

We unfortunately use the terms loosely in various parts of Python.

https://stackoverflow.com/questions/156767/whats-the-difference-between-an-argument-and-a-parameter#:~:text=A%20parameter%20is%20the%20variable,function%20when%20it%20is%20called.
@gpshead
Copy link
Member Author

gpshead commented Mar 20, 2022

Wording questions to ponder: Are they "default parameters" or "keyword parameters" potentially with a "non-" prefix, or are they "parameters with a default" and "parameters without a default" or "naked parameters" or "lone parameters"?

@gpshead
Copy link
Member Author

gpshead commented Mar 20, 2022

I'll update the golden value error message tests once we've agreed upon wording.

@Bluenix2
Copy link
Contributor

The most verbose and explicit definition would be: "a parameter with a default argument". Afterall, it is a parameter that has a default argument that gets passed if there is no argument. You could shorten this to "a parameter with a default" (optionally including "value" at the end). Technically you could also say "defaulted parameter" (reads better) - because if no argument is passed the parameter is defaulted with a default argument - which would be even shorter.

I do think "a keyword parameter" in the current changes might even be more confusing with a keyword-only parameter than the original saying of calling a parameter an argument though.

@Bluenix2
Copy link
Contributor

Bluenix2 commented Mar 21, 2022

Going off of my previous comment about a "defaulted parameter"; why not use "required parameter" for a parameter that lacks a default argument?

Now not only will this PR be more technically accurate, it'll also make the error easier to read:

- SyntaxError: non-default argument follows default argument
+ SyntaxError: required parameter follows defaulted parameter

...alternatively (since there is still repetition)...

- SyntaxError: non-default argument follows default argument
+ SyntaxError: required parameter follows parameter with a default value

I found myself tripping over the repetition of the previous error message and this should make it easy to tell the exact issue with the parameters. In the latter codeblock "value" could be replaced by "argument", either way it removes all repetition.

@gpshead gpshead added the stale Stale PR or inactive for long period of time. label May 25, 2023
@gpshead gpshead requested a review from CAM-Gerlach May 25, 2023 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review stale Stale PR or inactive for long period of time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants