[Python] Would it ever make sense to use multithreading for I/O bound operations in modern...

Discussão em 'Python' iniciado por Stack, Março 1, 2025.

  1. Stack

    Stack Membro Participativo

    I often hear that it in some circumstances it makes sense to use multi-threading for I/O operations (file operations, network communications, etc.). But why not just use asyncio for all I/O bound operations and stick to threads/processes for CPU-bound operations?

    Are there any scenarios you can think of when multithreading would be better to use than asyncio in modern python (i.e. 3.10+) for I/O bound operations?


    Why close this question? I don't think this is opinion-based. This can be very useful for people who are new to Python and not sure when to use multi-threading or async coroutines.

    There is also this question, which is very similar but it is out-dated: Does multithreading make sense for IO-bound operations?

    Continue reading...

Compartilhe esta Página