Skip to content

Conversation

@kdeldycke
Copy link

This is a small proposal that I am starting to apply everywhere in my own projects.

It fallows the lead of Python stdlib: python/cpython#118761

The idea consist in hiding all typing imports behind a hard-coded TYPE_CHECKING variable. Which Mypy is able to pick them up correctly, because TYPE_CHECKING is always evaluated to False at runtime, and to True during static analysis.

See an example at: python/cpython#128907

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant