Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Returning Unknown instead of Any for incomplete __getattr__ #13765

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

Closed
Avasam opened this issue Apr 2, 2025 · 1 comment · Fixed by #14030
Closed

Returning Unknown instead of Any for incomplete __getattr__ #13765

Avasam opened this issue Apr 2, 2025 · 1 comment · Fixed by #14030
Labels
project: policy Organization of the typeshed project stubs: false negative Type checkers do not report an error, but should

Comments

@Avasam
Copy link
Collaborator

Avasam commented Apr 2, 2025

I noticed we have quite a few

def __getattr__(name: str) -> Incomplete: ...

Wouldn't it be better to write as

def __getattr__(name: str): ...  # incomplete

So that type-checkers like Pyright in strict mode can warn about unknown types ?

@Avasam Avasam added the stubs: false negative Type checkers do not report an error, but should label Apr 2, 2025
@srittau
Copy link
Collaborator

srittau commented Apr 2, 2025

I think that was a pattern mandated in CONTRIBUTING for incomplete stubs. I think the current pattern just happened via the route

  1. -> Any: ... # incomplete
  2. -> Incomplete: ... # incomplete
  3. -> Incomplete: ...

That said, I don't have a strong preference either way.

@Avasam Avasam added the project: policy Organization of the typeshed project label May 12, 2025
srittau added a commit to srittau/typeshed that referenced this issue May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project: policy Organization of the typeshed project stubs: false negative Type checkers do not report an error, but should
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants