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.

Meta Ignores Brazilian Court Order to End Bolsonaro Favoritism

https://www.panamericandispatch.org/p/meta-ignores-brazilian-court-order
95•vrganj•1h ago•31 comments

We should be more ambitious with the software we build

https://danluu.com/ambitious/
436•ltratt•12h ago•372 comments

Cerebras Deploys Trillion-Parameter AI Models

https://www.cerebras.ai/blog/how-we-deploy-trillion-parameter-frontier-models-on-cerebras
166•gmays•8h ago•57 comments

How Japanese Dried Bonito Is Made

https://kottke.org/26/10/how-japanese-dried-bonito-is-made
40•bookofjoe•2d ago•14 comments

Online censorship is crushing indie webcomics

https://xtramagazine.com/culture/online-censorship-indie-webcomics-284463
35•Tomte•58m ago•12 comments

The Goose Programming Language

https://aardappel.github.io/goose/
401•bobbydigitales•14h ago•250 comments

Not Palantir

https://notpalantir.eu/
10•polyamid23•3h ago•1 comments

Rewriting a Commercial Engine in Jai

https://polygonjs.com/blog/why-i-rewrote-polygon-from-scratch
20•frading•2d ago•8 comments

SpeedCrunch 1.1

https://www.speedcrunch.org/
149•LordNibbler•14h ago•25 comments

Small Programs and Languages

https://ratfactor.com/cards/pl-small
112•andsoitis•12h ago•11 comments

America has lost 200k of jobs in media, film and the arts. How much is AI?

https://www.apricitas.io/p/ai-and-the-fall-of-the-creative-class
368•gnabgib•10h ago•365 comments

Why Gopher in 2026?

https://gopher.muffinlabs.com/sdf.org/users/nervtoji/phlog/001.txt
76•andsoitis•10h ago•25 comments

I Built a Stereo Vision Board for Hardware Hackers

https://rootkitlabs.com/2026/10/06/i-built-a-stereo-vision-board-for-hardware-hackers/
82•machinehum•4d ago•13 comments

I don't understand quantum physics (2018)

https://www.southampton.ac.uk/~doug/quantum_physics/index.html
315•rramadass•1d ago•252 comments

Local Wikipedia: Wikipedia, but only for things a half hour walk from you

https://edjefferson.com/localwiki/
1591•sohkamyung•2d ago•247 comments

FreeDNS

https://freedns.afraid.org/
293•esher•18h ago•79 comments

Node2Shell evolves to HTTP2Shell, blast radius affects many HTTP libs and apps

https://www.aikido.dev/blog/python-packages-vulnerable-node2shell-brotli-cve-2026-111497
318•theanonymousone•1d ago•154 comments

Social dynamics of toxic metal industry in medieval Europe

https://www.cambridge.org/core/journals/antiquity/article/social-dynamics-of-toxic-metal-industry...
48•XzetaU8•4d ago•22 comments

The Importance of Limitations for Creativity and Learning (2023)

https://ratfactor.com/cards/limitations
71•andsoitis•12h ago•19 comments

A story of a Figma bug that wasn't a bug at all (2021)

https://aresluna.org/this-is-a-story-of-a-figma-bug/
30•jllyhill•3d ago•1 comments

Pragtical v3.14 Lua-based text editor adds menus, floating views, and sessions

https://pragtical.dev/blog/pragtical-v3140-release
16•rd07•4d ago•2 comments

The St. Helena 5 pence coin shows Jonathan, a roughly 190 year old tortoise

https://de.numista.com/9866
116•schleck8•17h ago•38 comments

GPU-unlock: FP/BF16 instruction issue rate on Nvidia 3000's cards

https://github.com/Zagitta/gpu-unlock
248•fragebogen•1d ago•71 comments

Neural chip decodes interactions between brain regions

https://actu.epfl.ch/news/neural-chip-decodes-interactions-between-brain-r-2/
106•giuliomagnifico•18h ago•41 comments

In Rainbows

https://hitogata.neocities.org/Rainbows
27•surprisetalk•2d ago•8 comments

Roku developer repositories moved from GitHub to GitLab

https://blog.roku.com/developer/gitlab-move
287•cxr•17h ago•201 comments

Tablesample Picks Rows

https://boringsql.com/posts/tablesample/
3•surprisetalk•2d ago•0 comments

Show HN: Steal My Bitcoin

https://stealmybitcoin.com/
486•cloudlandsdev•13h ago•301 comments

Physicists trap a single antimatter particle for a month

https://www.scientificamerican.com/article/physicists-trap-a-single-antimatter-particle-for-a-month/
305•mooreds•3d ago•87 comments

Bbtree: Fastest Ordered Map

https://bbtree.xiangpeng.systems/post/
111•aoli-al•15h ago•11 comments