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.

More Tailscale tricks for your jailbroken Kindle

https://tailscale.com/blog/jailbroken-kindle-proxy-tun-modes
235•Error6571•6h ago•79 comments

National Security Determination Threat Posed by Foreign-Produced Robotic Devices [pdf]

https://www.fcc.gov/sites/default/files/robots-nsd.pdf
23•ellingsworth•53m ago•11 comments

SpecForge – A Platform for Authoring Formal Specifications

https://docs.imiron.io/v/0.5.10/en/tour.html
20•agnishom•1h ago•0 comments

Amiga Graphics Archive

https://amiga.lychesis.net/index.html
21•Bluestein•1h ago•2 comments

User Interfaces of the Demo Scene

https://www.datagubbe.se/scenegui/
242•zdw•7h ago•39 comments

SQLite in Production: Optimizing WAL Mode, Concurrency, and VFS Layers

https://micrologics.org/blog/sqlite-in-production-optimizing-wal-mode-concurrency-and-vfs-layers-...
91•ankitg12•4h ago•36 comments

Lisp moving Forth moving Lisp

https://letoverlambda.com/textmode.cl/guest/chap8.html
41•fallat•2d ago•13 comments

Codex Security

https://github.com/openai/codex-security
517•bakigul•14h ago•186 comments

Show HN: I was tired of opening 2 tabs for every HN link, so I made a userscript

https://github.com/twalichiewicz/HNewhere
331•twalichiewicz•13h ago•98 comments

Substack writers, you need a website

https://elizabethtai.com/2026/06/10/substack-writers-you-need-a-website/
564•speckx•18h ago•302 comments

Ancient Rome's version of Google Maps: how long to reach the beach

https://www.euronews.com/culture/2026/07/02/ancient-romes-version-of-google-maps-how-long-to-reac...
23•gnabgib•6d ago•19 comments

Half-Life ported to Mac OS 9

https://mac-classic.com/news/half-life-ported-to-mac-os-9/
260•freediver•14h ago•121 comments

Show HN: Vimgolf.ai – Learn Vim by playing through a map of levels

https://vimgolf.ai
10•nickandbro•2h ago•4 comments

Cracking Windows Open: Porting RADV to Win32

https://www.collabora.com/news-and-blog/news-and-events/cracking-windows-open-porting-radv-to-win...
53•zdw•7h ago•18 comments

LearnVector – Andrew Ng's AI company building one‑to‑one learning experiences

https://learnvector.ai/
207•ajhai•9h ago•127 comments

Kimi K3 Architecture Overview and Notes

https://sebastianraschka.com/blog/2026/kimi-k3-architecture-notes.html
446•ModelForge•19h ago•95 comments

ReFrame – The EPaper Camera

https://reframe.camera/
149•phil294•12h ago•32 comments

Steel Bank Common Lisp version 2.6.7

https://sbcl.org/all-news.html?2.6.7
243•tmtvl•18h ago•112 comments

Hubble: Open-source notetaking app for you and your agents

https://www.hubble.md/
123•handfuloflight•11h ago•56 comments

Delayed Gratification – Proud to Be 'Last to Breaking News'

https://www.slow-journalism.com/
306•speerer•19h ago•173 comments

Teach yourself programming in ten years (1998)

https://www.norvig.com/21-days.html
157•vinhnx•3d ago•94 comments

Transformer Transformer: A Unified Model for Motion-Conditioned Robot Co-Design

https://transformer-transformer.github.io/
57•ilreb•7h ago•6 comments

The only road in London where you have to drive on the right

https://www.mylondon.news/news/transport/only-road-london-you-drive-30499294
3•theanonymousone•1h ago•0 comments

Hooray for the Sockets Interface

https://blog.apnic.net/2026/07/28/hooray-for-the-sockets-interface/
42•jruohonen•9h ago•22 comments

Una GPS smart watch – Repairable, USB-C charging, developer-friendly

https://unawatch.com/
235•pimterry•20h ago•144 comments

60 Years Ago, a Submerged Submarine Circled the Globe for the First Time (2020)

https://www.popularmechanics.com/military/weapons/a32009109/operation-sandblast-sumbarine-circumn...
24•baud147258•1d ago•9 comments

Zig's Incremental Compilation Internals

https://mlugg.co.uk/posts/incremental-compilation-internals/
251•garyhtou•19h ago•179 comments

The iPhone Upgrade Program is being replaced by Apple Upgrade

https://www.apple.com/shop/iphone/iphone-upgrade-program
187•lkurtz•18h ago•334 comments

Now is the time to give LLMs access to the ACM digital library

https://cacm.acm.org/opinion/now-is-the-time-to-give-llms-access-to-the-acm-digital-library/
172•rbanffy•20h ago•146 comments

Interview with Boris Cherny [video]

https://www.youtube.com/watch?v=qyPCVqFUyDo
64•knighthacker•1d ago•68 comments