DEV Community

Discussion on: Advanced Static Typing with mypy (part1)

Collapse
 
richierunner profile image
Richie

Do you have any general guidance on type hinting class instance types that would:

  • avoid circular import
  • reduce import costs at runtime

Is this the way to go?
docs.python.org/3/library/typing.h...

Collapse
 
chadrik profile image
Chad Dombrova

Yes, if TYPE_CHECKING is the way to go. Note that if False also works, if you want to completely avoid importing the typing module.