-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Default arguments should be allowed to be other than NoValue #451
Comments
Hi @fsargent, Thank you for bringing up this issue. I agree that the current type restriction for the default parameter can be limiting. To better understand the scope of this problem and to consider it for a future update, it would be really helpful if you could provide a test case that highlights the current limitations and your needs. Your contribution in the form of a test would be invaluable for us to make the necessary adjustments. |
I don't quite follow what is ment by "provide a test case", but here is the use case.
The type of parameter |
For example, change the implementation of
i.e. specifying the allowable type for the default parameter |
is this project dead? |
Argument of type "Literal['']" cannot be assigned to parameter "default" of type "NoValue" in function "str"
"Literal['']" is incompatible with "NoValue"PylancereportGeneralTypeIssues
I believe this would be fixed by changing the methods definitions to Union types.
def str(self, var, default: Union(NoValue, str) = NOTSET, multiline=False):
The text was updated successfully, but these errors were encountered: