
Agreed. A "type import" is the second feature that I think we'd need. The syntax I came up with wasn't as good as yours, though, so I'm not going to present it. Guarding imports with "if TYPE_CHECKING" is common, and right now it breaks all introspection and sometimes makes string quoting necessary, even with PEP 563 and PEP 649. Jukka On Fri, Apr 16, 2021 at 6:47 PM Carl Meyer <carl@oddbird.net> wrote:
This proposal also naturally extends to:
type import mod
and
from mod type import X, Y
These use cases don't need the custom syntax support, but with the same lazy evaluation they would form a natural replacement for guarding imports with `if TYPE_CHECKING:`, which would also be compatible with PEP 649 and runtime evaluation of annotations.
Carl