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.

MiMo v2.6

https://mimo.xiaomi.com/mimo-v2-6
631•volf_•7h ago•315 comments

Spymarks, Not Watermarks

https://brand.io/article/spymarks/
197•possibilistic•4h ago•40 comments

I don't want to read what you didn't write

https://blog.colinbreck.com/i-dont-want-to-read-what-you-didnt-write/
391•mooreds•5h ago•134 comments

What Sun got wrong

https://bcantrill.dtrace.org/2026/09/20/what-sun-got-wrong/
527•chmaynard•13h ago•311 comments

Transformers Explained Visually

https://poloclub.github.io/transformer-explainer/
238•aray07•8h ago•40 comments

Attention is all you have

https://alicegg.tech/2026/09/21/attention
622•zer0tonin•13h ago•189 comments

NASA’s Mars Sample Return mission is dead

https://www.science.org/content/article/nasa-s-mars-sample-return-mission-dead
329•Muhammad523•8h ago•267 comments

AI coding has made CI a bottleneck, so we reworked ours to keep up

https://linear.app/now/ci-bottleneck-reworked
164•julian_digital•8h ago•175 comments

Claude Status – Elevated errors for multiple models

https://status.claude.com/incidents/7g1qpkyz5gxh
75•corvad•2h ago•59 comments

Divide by depth for instant 3D

https://gabrieloc.com/2026/09/15/perspective.html
99•gabrieloc•2d ago•17 comments

Looking forward to Git 2.56 – and 3.0

https://lwn.net/SubscriberLink/1094575/2385e98583715c2b/
50•chmaynard•4h ago•18 comments

The Advisory Group on Mathematics and Artificial Intelligence

https://terrytao.wordpress.com/2026/09/21/advisory-group-on-mathematics-and-artificial-intelligence/
104•digital55•8h ago•50 comments

Socrates vs. the Written Word (2011)

https://wondermark.com/socrates-vs-writing/
17•spectraldrift•3h ago•4 comments

More Floating Point Alternatives

https://wizardzines.com/comics/floating-point-alternatives/
13•vismit2000•2d ago•8 comments

Paper Models of Polyhedra

https://www.polyhedra.net/en/
9•pykello•2d ago•0 comments

Copper-Rs: Live Telemetry Deterministic Twins for Robots

https://www.copper-robotics.com/whats-new/copper-12-live-telemetry-and-replayable-logs-over-a-los...
5•gbin•2d ago•1 comments

How do traffic signals work? (2019)

https://practical.engineering/blog/2019/5/11/how-do-traffic-signals-work
66•at1as•11h ago•49 comments

Truman World

https://trumanworld.live
7•trollied•1d ago•9 comments

Frontier AI on Your Own Hardware

https://timdettmers.com/2026/09/21/dlab-open-source-week/
117•pretext•8h ago•60 comments

First Shader from Zero in Godot 4

https://www.gdquest.com/library/first_shader_godot4_portal/
40•ibobev•16h ago•6 comments

Kev: Tiny Jev-like family of decision models built on top of Qwen3.5

https://github.com/jaredpalmer/kev/tree/main
414•tosh•20h ago•189 comments

Turn off and restrict access to Apple Intelligence features on Mac

https://support.apple.com/guide/mac-help/turn-restrict-access-apple-intelligence-mchlb2e44f94/mac
258•alwillis•10h ago•174 comments

Grok 4.7

https://x.ai/news/grok-4-7
519•meetpateltech•12h ago•441 comments

HERMES radio enables voice and data communication over vast distances

https://spectrum.ieee.org/hermes-shortwave-radio-digital-data
108•SamuraiLion•11h ago•45 comments

Python Workers are now generally available

https://blog.cloudflare.com/python-workers-ga/
195•torutofu•14h ago•32 comments

Apple Copland D11E4 Booting in the Browser

https://www.pagetable.com/300
108•luu•9h ago•32 comments

Why does mathmain need an encrypted loader?

https://safedep.io/mathmain-encrypted-loader/
117•abhisek•9h ago•35 comments

Roboharm: Do frontier robot policies refuse unsafe instructions?

https://robocurve.org/roboharm/
38•msadowski•8h ago•21 comments

TXR: An Original, New Programming Language for Convenient Data Munging

https://www.nongnu.org/txr/
26•andsoitis•22h ago•3 comments

Smart Ring Maker Oura, Backers Seek $2.2B in US IPO

https://www.bloomberg.com/news/articles/2026-09-21/smart-ring-maker-oura-backers-seek-2-2-billion...
8•elo2000•57m ago•0 comments