New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy import concurrent.futures.process and thread #76777
Comments
Since PEP-562 is implemented, we can use lazy imports easily. Asyncio uses concurrent.futures.Future and concurrent.futures.ThreadPoolExecutor, Since importing concurrent.futures.process is slow, I want to import it lazily. Here is quick benchmark: $ ./python -m perf command ./python -c 'import asyncio' # patched
.....................
command: Mean +- std dev: 60.5 ms +- 0.1 ms
$ git stash
$ ./python -m perf command ./python -c 'import asyncio' # original
.....................
command: Mean +- std dev: 74.3 ms +- 0.2 ms |
I don't think this was a good idea. Making some imports implicitly lazy introduces unpredictability in stdlib imports. Here is an example bug report: |
What are issues with using global variable as import target? |
See this comment. |
Thank you Inada-san. My first intention when I seen this code was to simplify it, but then I have found that it was an intentional change. It may be easy to detect such code and raise a syntax warning or error. Or get rid of this limitation and allow globals officially here. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: