Fix Python – Difference between coroutine and future/task in Python 3.5?

Let’s say we have a dummy function:
async def foo(arg):
result = await some_remote_call(arg)
return result.upper()

What’s the difference between:
import asyncio

coros = []
for i in range(5):
coros.append(foo(i))

loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait(coros))

And:
import asyncio

futures = []
for i ….

Fix Python – asyncio.ensure_future vs. BaseEventLoop.create_task vs. simple coroutine?

I’ve seen several basic Python 3.5 tutorials on asyncio doing the same operation in various flavours.
In this code:
import asyncio

async def doit(i):
print(“Start %d” % i)
await asyncio.sleep(3)
print(“End %d” % i)
return i

if __name__ == ‘__main__’:
loop = asyncio.get_event_loop()
#futures = [asyncio.ensure_future(doit….

Fix Python – Simplest async/await example possible in Python

I’ve read many examples, blog posts, questions/answers about asyncio / async / await in Python 3.5+, many were complex, the simplest I found was probably this one.
Still it uses ensure_future, and for learning purposes about asynchronous programming in Python, I would like to see an even more minimal example, and what are the minimal tools necessa….

Fix Python – “Fire and forget” python async/await

Sometimes there is some non-critical asynchronous operation that needs to happen but I don’t want to wait for it to complete. In Tornado’s coroutine implementation you can “fire & forget” an asynchronous function by simply ommitting the yield key-word.
I’ve been trying to figure out how to “fire & forget” with the new async/await syntax released ….

Fix Python – multiprocessing vs multithreading vs asyncio in Python 3

I found that in Python 3.4 there are few different libraries for multiprocessing/threading: multiprocessing vs threading vs asyncio.
But I don’t know which one to use or is the “recommended one”. Do they do the same thing, or are different? If so, which one is used for what? I want to write a program that uses multicores in my computer. But I don’….

Fix Python – Asyncio.gather vs asyncio.wait

asyncio.gather and asyncio.wait seem to have similar uses: I have a bunch of async things that I want to execute/wait for (not necessarily waiting for one to finish before the next one starts). They use a different syntax, and differ in some details, but it seems very un-pythonic to me to have 2 functions that have such a huge overlap in functiona….