python - Why I can't use concurrent.futures in asyncio event loop? -


from asyncio documentation states asyncio has:

"a future class mimics 1 in concurrent.futures module, adapted use event loop;"

why there need have 2 different future classes in standard library (in asyncio , in concurrent)? , why there necessity adapt event loop? missing here, or made them decide way?

why there need have 2 different future classes in standard library (in asyncio , in concurrent)?

while these classes looks similar, using 2 different paradigms of concurrent programming , have different implementations , interfaces. example,

concurrent.futures.future used thread/process based concurrent programming , shouldn't know nothing event loop because there isn't 1 in case. it's result method blocks thread's/process's execution flow till timeout or future done.

asyncio.future used coroutines based concurrent programming , should know event loop, coroutine-functions , other related stuff. it's result method wouldn't block execution flow since execution flow shouldn't block @ in case. instead should await future till it's done allowing execution flow returned , managed event loop.

there no benefits in mixing them, while splitting classes makes theirs implementations easier , interfaces clearer.


Comments