-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
gh-137786: fix error msg for *args, **kwargs default value #137793
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -461,22 +461,22 @@ | |||||
| >>> def foo(a,*b=3,c): | ||||||
| ... pass | ||||||
| Traceback (most recent call last): | ||||||
| SyntaxError: var-positional parameter cannot have default value | ||||||
| SyntaxError: var-positional parameter's default value cannot be changed because it has the immutable default value () | ||||||
| >>> def foo(a,*b: int=,c): | ||||||
| ... pass | ||||||
| Traceback (most recent call last): | ||||||
| SyntaxError: var-positional parameter cannot have default value | ||||||
| SyntaxError: var-positional parameter's default value cannot be changed because it has the immutable default value () | ||||||
| >>> def foo(a,**b=3): | ||||||
| ... pass | ||||||
| Traceback (most recent call last): | ||||||
| SyntaxError: var-keyword parameter cannot have default value | ||||||
| SyntaxError: var-keyword parameter's default value cannot be changed because it has the immutable default value {} | ||||||
|
||||||
| >>> def foo(a,**b: int=3): | ||||||
| ... pass | ||||||
| Traceback (most recent call last): | ||||||
| SyntaxError: var-keyword parameter cannot have default value | ||||||
| SyntaxError: var-keyword parameter's default value cannot be changed because it has the immutable default value {} | ||||||
| >>> def foo(a,*a, b, **c, d): | ||||||
| ... pass | ||||||
|
|
@@ -577,11 +577,11 @@ | |||||
| >>> lambda a,*b=3,c: None | ||||||
| Traceback (most recent call last): | ||||||
| SyntaxError: var-positional parameter cannot have default value | ||||||
| SyntaxError: var-positional parameter's default value cannot be changed because it has the immutable default value () | ||||||
|
||||||
| SyntaxError: var-positional parameter's default value cannot be changed because it has the immutable default value () | |
| SyntaxError: Cannot change the default value of a var-positional parameter because it is already defined. |
@AA-Turner Maybe this would make more sense to people?
For me, “immutable default value” feels too detailed, and the current message isn’t very user-friendly.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| fix error msg for *args, **kwargs default value | ||
| Yoonho Hann. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
I don't think this is clearer. "var-positional parameter cannot have default value" is oddly worded but I think equal or better to this proposal.