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.

Derek Lowe: Detonating a Pile of Lead Azide

https://www.science.org/content/blog-post/detonating-huge-pile-lead-azide-really
192•beginning_end•2h ago•117 comments

Lean Verification of the Riemann Hypothesis - Joint statement by...

https://leanprover-community.github.io/blog/posts/riemann-hypothesis/
165•g-b-r•1h ago•124 comments

Brazil's tax authority open-sources its tax calculator on GitHub under MIT

https://www.gov.br/receitafederal/pt-br/assuntos/noticias/2026/novembro/receita-federal-publica-p...
365•dvaplima•4d ago•118 comments

My Monitor Was Cutting My Download Speed by 75%

https://blog.tymscar.com/posts/studiodisplayethernet/
198•soheilpro•5h ago•80 comments

Hurried Announcement: Alessandro Masullo GRH

https://math216.wordpress.com/2026/11/20/hurried-announcement-alessandro-masullo-grh/
2278•jasondavies•21h ago•1080 comments

Levent Alpöge claims proof of the Generalized Riemann Hypothesis [pdf]

https://alpo.ge/remark.pdf
2787•iamronaldo•1d ago•1957 comments

I'm quite pleased by the tech architecture of my art website

https://klauria.tech/klauria-art/
20•evakhoury•23h ago•2 comments

RCE in Gnupg

https://lists.gnupg.org/pipermail/gnupg-announce/2026q4/000517.html
140•gdgghhhhh•7h ago•47 comments

Inkling 2 Mini

https://thinkingmachines.ai/news/inkling-2-mini/
1177•jasondavies•20h ago•226 comments

Show HN: Zero C#, Power of C# without any GC

https://onurgumus.github.io/zero-csharp/index.html
4•reverseblade2•33m ago•0 comments

LLMs can read and write executables byte by byte from a hex dump

https://sgiannopoulos.github.io/blog/machine-code-programming/
70•fortran77•3d ago•49 comments

Astra 6.2 and Sol 6.2 flop at Simple Bench

https://simple-bench.com/
74•algoth1•2h ago•62 comments

We promoted developers into architects without informing them

https://manidoraisamy.com/developer-to-architect.html
517•QueensGambit•21h ago•288 comments

Ask HN: I have been unemployed for 2y. 15 years of experience, US. What to do?

385•LetThingsBeDiff•16h ago•396 comments

Unforced Navier-Stokes Singularity and the Generalized Riemann Hypothesis

https://terrytao.wordpress.com/2026/11/20/unforced-euler-singularity-unforced-navier-stokes-singu...
500•archon1410•22h ago•212 comments

ClawDOS – An AI coding agent for DOS

http://ricapar.net/ClawDOS/
125•Ricapar•10h ago•39 comments

Clojure will affect the way you think about programming (2017)

https://eli.thegreenplace.net/2017/clojure-the-perfect-language-to-expand-your-brain/
155•sammatilda•13h ago•64 comments

NINLIVE: The Nine Inch Nails live archive

https://ninlive.com/
312•CharlesW•17h ago•81 comments

Deterministic Simulation Testing Is for Everyone

https://outdata.net/blog/261120
8•pgraug•1d ago•0 comments

Surprisingly Adorable Insect Portraits

https://amateurphotographer.com/latest/these-astonishing-insect-portraits-reveal-a-hidden-world-y...
102•NordStreamYacht•9h ago•23 comments

Language Models Can Rewrite Their Own Weights

https://arxiv.org/abs/2611.21885
450•lwhsiao•23h ago•133 comments

Defcon 5's California Caravan Program/Zine

https://netninja.com/2026/06/08/defcon-5s-california-caravan-program-zine/
18•speckx•3d ago•0 comments

FBI reportedly investigating apparent hack of its criminal database

https://www.bbc.com/news/articles/cvze7de86pk3o
114•theanonymousone•5h ago•51 comments

Slopstrap – Make your site look hastily vibecoded

https://slopstrap.mikelacher.com/
448•mlacher•1d ago•74 comments

Nasdaq erases all 2026 gains as AI sell-off dampens Anthropic’s second day

https://www.theguardian.com/business/2026/nov/20/global-stock-markets-slump-anthropic-ipo-ai-sell...
419•cdrnsf•1d ago•740 comments

Show HN: An ASCII cell aquarium for your terminal

https://github.com/kborer/cells/
7•kborer•3d ago•8 comments

Sir Brian May adds new dimension to Hera asteroid

https://www.esa.int/articles/about-us/directorates/operations/space-safety/hera/sir-brian-may-add...
135•mooreds•16h ago•31 comments

Valkey kills the skiplist, cuts sorted set overhead by up to 43%

https://valkey.io/blog/from-skiplist-to-b+tree/
170•reconditerose•3d ago•60 comments

DreamCoder: Coding harness and IDE from the author of Mastering Emacs

https://www.masteringemacs.org/article/announcing-dreamcoder
256•facundo_olano•20h ago•104 comments

Finite-time blow-up for the Navier–Stokes equations

https://github.com/tristanbuckmaster/navier-stokes/
306•trotro•1d ago•96 comments