-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Better message for "Function ... could always be true" #14529
Comments
@JukkaL This is my initial attempt to make the message better. Please let me know if that looks good. |
can we implement this behaviour instead def f(x: int) -> str: pass if callable(f): |
While at it, would it favor usability by adding the presumptuous "; did you mean to call it?" ...? |
can this be assigned to me? |
Better message for "Function ,could always be true" python#14529
Is this issue still open? |
This issue is still open, since there is no PR with test cases so we don't whether any attempts are working or not. PRs are welcome! |
Consider this example:
It generates this error:
Instead, if we have a direct reference to a function definition, we could generate a message like this which would be clearer, especially if the signature is complex:
There are at least these different cases to consider:
if mod.func:
).if obj.method:
).Var
node) with typeCallable[...]
(in this case we could show the name of the variable/attribute or the callable type -- both would be okay).if func():
wherefunc
returns a callable. Here the best option is to show the callable type as we do now.The text was updated successfully, but these errors were encountered: