Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks
1–10 of 79 posts
Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks
#2Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks
#3Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks
#4The example from this StackOverflow question might be a better demonstration: https://stackoverflow.com/q/63455683
Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks
#5Here’s a horror story for you.
A few years ago I worked for this startup as a principal engineer. The engineering manager kept touting how he was from XYZ and that he ran Pythonista meetups and how vast his knowledge of Python was. We were building a security product and needed to scan hundreds of thousands of documents quickly so we built a fan out with coroutines. I came on board well into this effort to assist in adding another adapter to this other platform that worked similarly. After seeing all the coroutines, being pickled and stored in S3, so that nodes could “resume” if they crashed yet - not a single create_task was present. All of this awaiting, pickling, attempting to resume, check, stuff, report, pickle, happened synchronously.
When trying to point out the issue with the architecture and getting into a shouting match with Mr. Ego, I was let go.
Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks
#6Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks
#7 async def parent():
print("parent before")
task = asyncio.create_task(child()) # Re: Await Is Not a Context Switch: Understanding Python's Coroutines vs. Tasks
#8In Python there's asyncio vs threading, and I feel there's just too much to navigate to quickly get up and running. Do people just somehow learn this just when they need it? Is anyone having fun here?