Hi,

Many times, I was confused by the link between asyncio and
concurrent.futures modules.

For example, on CPython FreeBSD 6.2 buildbot, concurrent.futures
module is missing, and so asyncio module cannot be imported. In my
opinion, this is a bug: you should be able to use callbacks and
coroutines without a pool of threads or processes. Another example is
my backport of asyncio on Python 2.x, I didn't understand why I had to
backport also concurrent.futures (by the way, there is a backport on
PyPI, I will reuse it).

I found some references to concurrent.futures in asyncio source code.

asyncio/futures.py:
---
# TODO: Do we really want to depend on concurrent.futures internals?
Error = concurrent.futures._base.Error
CancelledError = concurrent.futures.CancelledError
TimeoutError = concurrent.futures.TimeoutError
---

asyncio/tasks.py:
---
FIRST_COMPLETED = concurrent.futures.FIRST_COMPLETED
FIRST_EXCEPTION = concurrent.futures.FIRST_EXCEPTION
ALL_COMPLETED = concurrent.futures.ALL_COMPLETED
---

And BaseEventLoop.run_in_executor() creates a default executor (a pool
of threads) if none was defined.

Is there a reason to reuse concurrent.futures exceptions and states
(string constants), except confusing me? :-)

Victor

Reply via email to