Open niklasf opened 4 years ago
TypeAlias
can already be used from typing_extensions
(with no need of actually having typing_extensions
installed, mypy looks up the stub in the typeshed and sees it as a part of the standard library).
@bswck Interesting. Won't import typing_extensions
fail at runtime if it's not present, or is there a way to avoid that?
@bswck Interesting. Won't
import typing_extensions
fail at runtime if it's not present, or is there a way to avoid that?
Won't fail if we don't perform the import at runtime at all, i.e. in the if typing.TYPE_CHECKING:
block.
Then we can enable PEP 563 behavior to not evaluate type annotations at runtime.
Ah, cool. Done.
int.bit_count
typing.TypeAlias
instead of aliases configured indoc/conf.py
typing.Union
syntax