Skip to content

How to enforce stricter Any type checking in Pyright strict mode? #9611

Answered by erictraut
rafrafek asked this question in Q&A
Discussion options

You must be logged in to vote

Any has a very specific meaning in the Python typing spec, and pyright conforms to the spec. For more details, refer to this section of the spec.

If you want your code to be fully type checked, you should avoid using Any wherever possible. When you use Any, you're effectively telling the type checker "I don't know what type this is, so assume that it's any type that could possibly satisfy type checking constraints".

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rafrafek
Comment options

Answer selected by rafrafek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants