That's a mypy-specific hack, not something that's guaranteed by a PEP -- but it works great with mypy!
On Mon, Jan 18, 2021 at 4:40 PM Brandt Bucher firstname.lastname@example.org wrote:
Doesn't explicitly setting it yourself still work?
TYPE_CHECKING = False if TYPE_CHECKING: import xxx # modules used only in type hints.
This seems to work for mypy, at least. Even just doing `if False:` works correctly (and is arguably the most efficient at runtime). _______________________________________________ Python-ideas mailing list -- email@example.com To unsubscribe send an email to firstname.lastname@example.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://email@example.com/message/P5W5ET... Code of Conduct: http://python.org/psf/codeofconduct/