frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

The Fundamentals of Asyncio

https://github.com/anordin95/a-conceptual-overview-of-asyncio/blob/main/readme.md
76•anordin95•4h ago

Comments

anordin95•4h ago
I've used Python's asyncio a couple times now, but never really felt confident in my mental model of how it fundamentally works and therefore how I can best leverage it. The official docs provide decent documentation for each specific function in the package, but, in my opinion, lack a cohesive overview of the systems design and architecture. Something that could help the user understand the why and how behind the recommended patterns. And a way to help the user make informed decisions about which tool in the asyncio toolkit they ought to grab, or to recognize when asyncio is the entirely wrong toolkit. This is my attempt to fill that gap.
sandeep1998•4h ago
thank you for that.
whinvik•3h ago
This is excellent. Thanks.
omh1280•3h ago
Great read!

Python asyncio can really screw up your runtime performance if you use it poorly. And it's _really_ easy to use poorly.

Consider a FastAPI server using asyncio instead of threading. _Any_ time you drop down into a synchrononous API, you better be sure that you're not doing anything slow. For example, encoding or decoding JSON in Python actually grabs the GIL depending on what library you're using, and then you have no hope of releasing control back to asyncio.

kccqzy•1h ago
That's a GIL problem not an async problem. Even if you choose to ditch asyncio and use threads, you still need to care about the GIL. And when I use asyncio I don't worry about CPU-bound tasks like encoding or decoding JSON; I worry about some library doing I/O synchronously regardless of whether such library releases the GIL or not.
bb88•37m ago
This is spot on. GIL-less python will be a thing, and when it happens, there will still be no reason to combine asyncIO with thread primitives. Waiting for IO can be spun off into a new thread, and it will work as you expect it would.

Trying to combine mental models of asyncio and threading is a model for pure insanity.

alex5207•3h ago
[About the event loop]

> She's behind the scenes managing resources. Some power is explicitly granted to her, but a lot of her ability to get things done comes from the respect & cooperation of her subordinates.

What a wonderful paragraph. Playful, yet with a deep meaning. It makes the article a joy to read.

cadamsdotcom•2h ago
Awesome job closing a gap in the asyncio docs - wonder if it could be contributed back & be added!
paulgb•2h ago
This is great! Thanks for writing it.

One nit, the unquoted quotes in this file seem to be a parse error (I replaced the inner ones with single quotes and it ran) https://github.com/anordin95/a-conceptual-overview-of-asynci...

anordin95•1h ago
Ah, I'm so glad to hear it. And, thank you for the nit/feedback! I generally use python3.12 for my work which doesn't error out on that line. However, python3.11 and below will raise a SyntaxError on it. I've fixed the issue there and in a few other places and pushed the changes :)
Izkata•1h ago
> Frankly, I'm not sure why that design decision was made and find it rather confuses the meaning of await: asynchronously wait.

I've always understood it to mean "wait for asynchronous object", not that the wait itself is asynchronous. It's just an English word that roughly means "wait for", that was chosen for the nice "a" prefix for asynchronous stuff.

anordin95•1h ago
Mmm fair point! Though, coroutines aren't really asynchronous objects in that usage, right? Since `await coroutine` would run that coroutine synchronously.

Warfarin: From rat poison to clinical use

https://idp.nature.com/authorize?response_type=cookie&client_id=grover&redirect_uri=https%3A%2F%2Fwww.nature.com%2Farticles%2Fnrcardio.2017.172
1•kamaraju•36s ago•0 comments

MCP Servers are surprisingly easy. I made one that runs code in a sandbox

https://runno.dev/articles/mcp/
1•benno128•3m ago•0 comments

Unlocked Trump Memecoins Set to Boost President's Wealth by $100M

https://www.bloomberg.com/news/articles/2025-07-16/trump-memecoin-unlock-to-test-crypto-demand-boost-president-s-wealth
2•lawrenceyan•4m ago•0 comments

X-59: NASA's quiet supersonic test jet rolls

1•atlashere•5m ago•0 comments

The Latest GPT-5 Leaks and Teasers

https://www.bgr.com/1918358/chatgpt-gpt-5-rumors-leaks-teasers/
1•Bluestein•6m ago•0 comments

Zef – Raku Module Management

https://github.com/ugexe/zef
1•TheWiggles•7m ago•0 comments

Nothing Is Luxury

https://doppioperfavore.substack.com/p/nothing-is-luxury
1•gigikenn•9m ago•0 comments

Sexual Offender or Not?

https://facecrime.io/
1•PlayMain•9m ago•0 comments

A tiny CMS built on Cloudflare Workers and D1, no back end required

https://github.com/gnarzilla/deadlight-bootstrap
2•gnarzilla_•10m ago•1 comments

L4MPLIGHT (Conlangs and custom microtonal music notation) demo video

https://www.youtube.com/watch?v=cMnuMjXeHrY
1•bogdanoff_2•10m ago•0 comments

Open-source SEC EDGAR MCP server

https://github.com/stefanoamorelli/sec-edgar-mcp
1•stefano-amore•11m ago•0 comments

Ask HN: Thinking About a Health Analytics Startup. Would Hospitals Even Use It?

1•prism_wisdom•13m ago•0 comments

LetsEncrypt – Complete Outage

https://letsencrypt.status.io/
4•kenshaw•16m ago•0 comments

#1 AI image generator and editor

https://ai-flux.io/flux-11-pro
1•victor_cl•18m ago•0 comments

Debugging the One-in-a-Million Failure: Migrating Pinterest Search to K8s

https://medium.com/pinterest-engineering/debugging-the-one-in-a-million-failure-migrating-pinterests-search-infrastructure-to-kubernetes-bef9af9dabf4
1•Wagthesam•19m ago•0 comments

Warfarin

https://en.wikipedia.org/wiki/Warfarin
2•kamaraju•20m ago•0 comments

Large US Grid [PJM] Lacks Capacity for New Data Centers, Watchdog Says

https://www.bloomberg.com/news/articles/2025-07-21/large-us-grid-lacks-capacity-for-new-data-centers-watchdog-says
1•toomuchtodo•20m ago•1 comments

ChatGPT 'router' that automatically selects the right model for job imminent

https://venturebeat.com/ai/a-chatgpt-router-that-automatically-selects-the-right-openai-model-for-your-job-appears-imminent/
5•Bluestein•30m ago•0 comments

Ask HN: Why is Gmail so incompetent at basic search?

9•sn9•33m ago•3 comments

OpenAI says ChatGPT users send over 2.5B prompts every day

https://www.theverge.com/news/710867/openai-chatgpt-daily-prompts-2-billion
4•vedhsaka•35m ago•7 comments

Nine households control 15% of wealth in Silicon Valley as inequality widens

https://www.theguardian.com/us-news/2025/jul/21/silicon-valley-income-wealth-gap
13•c420•40m ago•2 comments

We're building cross-functional AI-native teams (Would love your feedback)

https://medium.com/thumbtack-engineering/the-ai-engineering-shift-6061d98ac8a8
2•purusmahe•41m ago•1 comments

Gilles Dowek has died, aged 58

https://fr.wikipedia.org/wiki/Gilles_Dowek
3•ColinWright•48m ago•1 comments

Tomoz App – Plan for Tomorrow

https://apps.apple.com/gb/app/tomoz/id6748755747
1•TheChelsUK•51m ago•0 comments

Tell HN: Private Equity Scam – Asks for Rev#s+Fees

1•artur_makly•53m ago•0 comments

A Practical Comparison of AI Coding Agents

https://jaredforsyth.com/posts/practical-comparison-of-ai-agents/
1•jaredly•54m ago•1 comments

What Happens to Leftover Hotel Soap?

https://reasonstobecheerful.world/upcycling-leftover-hotel-soap/
1•PaulHoule•54m ago•0 comments

Sapling

https://sapling-scm.com/
2•Bogdanp•55m ago•0 comments

Build a Duck Hunt Clone in TypeScript – Game Dev Tutorial [video]

https://www.youtube.com/watch?v=UZSmn3n3wqE
1•JSLegendDev•57m ago•0 comments

SoftBank and OpenAI's $500B AI Project Struggles to Get Off Ground

https://www.wsj.com/tech/ai/softbank-openai-a3dc57b4
4•mfiguiere•1h ago•0 comments