Does importing modules which are only used for type-checking have any runtime overhead?
At the moment I am excluding all the type-checking imports from runtime as code below but now wondering if this is necessary and whether these actually get compiled into the .pyc and used at runtime anyway? import os interactive_mode: bool = True if os.getenv('PYCHARM_HOSTED') else False if interactive_mode: from typing import Iterator, Any import types from types import FrameLocalsProxyType from wsgiref.types import StartResponse Does Python type hint (annotations) cause some run-time effects? doesn't really answer the question; it is about the annotations, not the imports. The root question
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.