Skip to content
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

Improve message if user forgot to call a function #7687

Open
JukkaL opened this issue Oct 10, 2019 · 0 comments
Open

Improve message if user forgot to call a function #7687

JukkaL opened this issue Oct 10, 2019 · 0 comments

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Oct 10, 2019

Forgetting to call a method, i.e. missing (), is a somewhat common programming error. Mypy will typically catch this error, but often error messages includes something like "Callable[...]" has no attribute "foo". Since the callable type may be pretty complicated, this can look confusing.

Here are a few ideas that could make this better:

  1. Only say Callable object has no attribute "foo" (omit the full callable type).
  2. Add a note such as Did you mean ".foo()" (with parentheses)? (needs wordsmithing).
  3. In addition to (1), show the signature of the function in a separate note pretty-printed using function definition syntax such as def foo() -> List[X].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants