frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

How async/await works in Python (2021)

https://tenthousandmeters.com/blog/python-behind-the-scenes-12-how-asyncawait-works-in-python/
61•sebg•1y ago

Comments

quentinp•1y ago
While it stays at the Python level, https://github.com/AndreLouisCaron/a-tale-of-event-loops really helped me to understand how asyncio and Trio are implemented. I had no idea how sleeps worked before reading that post.
incomingpain•1y ago
Page didnt load for me.

https://realpython.com/async-io-python/

Multiprocessing all the way!

emmelaich•1y ago
(2021)

Good article!

punnerud•1y ago
A more simplified version:

Synchronous code is like a single-lane road where cars (tasks) must travel one after another in perfect sequence. If one car stops for gas (waiting for I/O), every car behind it must stop too. While orderly and predictable, this creates massive traffic jams as tasks wait unnecessarily for others to complete before they can proceed.

Pure asynchronous code (with callbacks) is like dispatching multiple cars onto independent routes with no coordination. Cars move freely without waiting for each other, but they arrive at unpredictable times and following their progress becomes chaotic. It's efficient but creates a complex tangle of paths that becomes hard to maintain.

Async/await combines the best of both approaches with a multi-lane highway system. Cars follow clear, synchronous-looking routes (making code readable), but only wait at strategic "await" exit ramps when truly necessary. When a car needs data, it signals with "await", pulls off the highway temporarily, and other cars continue flowing past. Once its operation completes, it merges back into traffic and continues. This gives you the logical simplicity of synchronous code with the performance benefits of asynchronous execution - cars only wait at crossroads when they must, maximizing throughput while maintaining order.

The genius of async/await is that it lets developers write code that looks sequential while the runtime handles all the complex traffic management under the hood.

explodes•1y ago
Excellent write up. I appreciate the level of details here showing the history from the days of old, before async/await were even keywords.
bilsbie•1y ago
How does the GIL come into play here?
punnerud•1y ago
GIL is like a "red-cap" on the head for the CPU-core running the task, so you would not be able to run true Async without GIL. Have to hand the "red-cap" back, for the next task.

Instead of using a global lock ("red-cap"), Python objects have introduced a specialized reference counting system that distinguishes between "local" references (owned by a single thread) and "shared" references (accessed by multiple threads).

In that way enabling to remove GIL in the long run, now starting with making it optional.

ElevenLabs, TwelveLabs, ThirteenLabs

https://quantumi.sh/public/labs.html
85•jemoka•2h ago•24 comments

A Kantian Critique of "Sorry" by Justin Bieber

https://decodingvibes.com/blog/a-kantian-critique-of-sorry-by-justin-bieber/
151•altmanaltman•3h ago•61 comments

A Friendly Introduction to Racket

https://geometridae.bearblog.dev/a-friendly-introduction-to-racket/
47•signa11•3h ago•10 comments

Munder Difflin – Agent harness to run an office of your clones

https://munderdiffl.in/
181•simonpure•7h ago•75 comments

The New MCP Roadmap

https://blog.modelcontextprotocol.io/posts/mcp-roadmap/
105•pentagrama•3h ago•81 comments

Z80 – The 1970s Microprocessor Still Alive (2021)

https://www.computer.org/csdl/magazine/mi/2021/06/09623402/1yJTvlRLmhi
84•asdefghyk•7h ago•37 comments

Show HN: Rotation via Double Reflection

https://static.laszlokorte.de/rotor-reflect/
29•laszlokorte•23h ago•6 comments

Rust Glancer: Rust LSP using 100x less RAM

https://rust-glancer.github.io/blog/hello-world/
359•matklad•21h ago•72 comments

Learning about "The Unix Time-Sharing System"

https://playtechnique.io/long/the-unix-time-sharing-system.html
3•gwynforthewyn•1h ago•1 comments

Felony Bench

https://www.felonybench.com/
798•colinprince•1d ago•315 comments

Hook, hold, harvest and hide: Meta's alleged strategy laid out in first week

https://www.theguardian.com/technology/2026/aug/22/meta-trial-children-privacy
159•sbulaev•5h ago•110 comments

Anthropic IPO filing will show AI backlash as a risk factor, sources say

https://www.cnbc.com/2026/08/21/-anthropic-ipo-filing-will-show-ai-backlash-as-risk-sources-say.html
12•newsomix9xl•48m ago•6 comments

Kobo can run apps now

https://bandarlabs.github.io/Cobalt/
625•thepoet•1d ago•199 comments

Felony charges for citizen deleting phone data at US Border

https://www.nytimes.com/2026/08/21/us/politics/samuel-tunick-deleted-phone-felony.html
979•floathub•1d ago•1194 comments

Stop Making TUIs

https://sockpuppet.org/blog/2026/08/20/stop-making-tuis/
322•underdeserver•1d ago•416 comments

I accidentally logged hundreds of thousands of phone calls to military bases

https://lina.sh/blog/hijacking-e164-arpa
628•gavide•1d ago•81 comments

Kagi added a setting for removing paywalled links from search results

https://kagi.com/changelog#11296
1204•speckx•1d ago•376 comments

There's no reason for software to be slow anymore

https://danluu.com/perf-opt/
577•Jach•16h ago•415 comments

OTel isn’t going well

https://matduggan.com/otel-isnt-going-well-and-i-made-a-spreadsheet-about-it/
191•hn_acker•23h ago•89 comments

Zig’s Io.Threaded is neat

https://matklad.github.io/2026/08/06/neat-io-threaded.html
129•chilipepperhott•1d ago•75 comments

Scientists release biggest 2D map of the universe

https://newscenter.lbl.gov/2026/08/10/scientists-release-biggest-2d-map-of-the-universe/
239•NKosmatos•22h ago•64 comments

AI boosted homework scores, then exam scores dropped: study

https://www.economist.com/graphic-detail/2026/08/18/does-ai-stop-children-from-learning
360•dash2•3d ago•354 comments

How Thailand Resisted Colonization

https://worksinprogress.co/issue/how-thailand-resisted-colonization/
98•karakoram•22h ago•32 comments

Embedded AI

https://nostarch.com/embedded-ai
24•0x54MUR41•8h ago•9 comments

Three important steps in my maturation process

https://thomasdullien.github.io/posts/2026-08-21-three-important-steps-in-my-maturation-process/
195•tdullien•18h ago•98 comments

Claudette: Make Claude stop talking like a BuzzFeed article

https://github.com/adnanakil/nobuzz/blob/main/README.md
333•aakil•1d ago•213 comments

I'm becoming AI-blind

https://cymerys.com/w/im-becoming-ai-blind
456•rcymerys•1d ago•463 comments

Early-life stress leaves a 'scar' inside brain cells in mice

https://medicine.washu.edu/news/how-early-life-stress-leaves-a-scar-inside-brain-cells/
129•gmays•1d ago•60 comments

People of ACM – Russ Cox

https://www.acm.org/articles/people-of-acm/2026/russ-cox
161•signa11•5d ago•20 comments

Everyone says assembly is untyped—everyone is wrong

https://www.gingerbill.org/article/2026/08/20/designing-odins-inline-asm/
133•adamrezich•2d ago•60 comments