Has anyone considered making TYPE_CHECKING not require importing 'typing'?
19 Sep
2020
19 Sep
'20
3:14 a.m.
Having to always import 'typing' to use TYPE_CHECKING bugs me. It's probably because I hide everything type-related under `if typing.TYPE_CHECKING: ...` to clearly separate it from runtime stuff, but this blocks me from putting the 'typing' import in that block. Has it ever been discussed to have type checkers recognize `if TYPE_CHECKING := False: ...` to allow skipping the 'typing' import? I guess another option is some `__type_checking__` built-in like `__debug__`, but defining a new built-in is a harder sell.
1307
Age (days ago)
1307
Last active (days ago)
2 comments
3 participants
participants (3)
-
Anthony Sottile
-
Brett Cannon
-
Guido van Rossum