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.

Cloudflare will be fully post-quantum in 2027

https://blog.cloudflare.com/project-quantum-leap/
521•jupenur•5h ago•240 comments

Laravel for COBOL

https://github.com/pihedy/laravel-cobol
82•choult•50m ago•23 comments

Introducing MiniMax M4

https://github.com/MiniMax-AI/MiniMax-M4
106•cmrdporcupine•1h ago•27 comments

How Far Behind Are Open-Weight Models?

https://sebastianraschka.com/blog/2026/how-far-behind-are-open-weight-models.html
73•ModelForge•1h ago•45 comments

Steller's sea cow: First historical extinction of a marine mammal at human hands

https://www.nhm.ac.uk/discover/stellers-sea-cow-first-historical-extinction-of-marine-mammal-at-h...
50•zeristor•2d ago•8 comments

Transferring Human Thoughts into Qwen

https://ruxytrace.com/research/thought-transfer/
125•pioborgelt•4h ago•57 comments

Bayer's 'Feed a Bee' campaign was used to fight bee protections

https://www.grilled.media/feed-a-bee/
341•randycupertino•2h ago•105 comments

I wish we’d stop talking about how we’re going to cure cancer

https://www.science.org/content/blog-post/stop-it-just-stop-it
1030•surprisetalk•4h ago•578 comments

Show HN: ArchLang – floor plans as code, compiled to SVG/DXF/PDF

https://playground.archlang.uk/
91•chanmeng•2d ago•29 comments

Show HN: Nixorium – NixOS fleet management, in daily use in my school's labs

https://github.com/giovantenne/nixorium
43•zener79•3h ago•23 comments

Anatomy of an AI Kill Chain

https://ai-killchain.airwars.org
459•tastyface•9h ago•326 comments

Show HN: misa77 – Up to 3x faster decompression than zstd, with better ratios

https://github.com/welcome-to-the-sunny-side/misa77/tree/main
191•nonadhocproblem•9h ago•62 comments

What Could Object Pascal Look Like in 2030?

https://blogs.remobjects.com/2026/12/02/a-vision-for-pascal-2030-at-ekon/
11•carteragecat•3h ago•2 comments

Show HN: Simulating a 1975 dungeon board game to fix its class balance

https://github.com/someben/dungeon-bang
84•someben•2d ago•29 comments

Sift: The Lisp formatter I kept trying to write (+lint and LSP)

https://jointhefreeworld.org/blog/articles/lisps/sift-the-lisp-formatter-i-kept-trying-to-write/
17•jjba23•20h ago•15 comments

NSA advises immediate transition to post-quantum cryptography

https://www.nsa.gov/Press-Room/Press-Releases-Statements/Press-Release-View/Article/4662430/nsa-a...
2610•intunderflow•1d ago•1239 comments

This Lady Is Hitting Every Shop in NYC (2024)

https://annekadet.substack.com/p/locavore
3•NaOH•3d ago•0 comments

Bickering Buildings: A Dialogue Between the Churches of Athens in 1854

https://publicdomainreview.org/essay/bickering-buildings/
12•diodorus•2d ago•1 comments

All Software Sucks

https://harmful.cat-v.org/software/
131•archargelod•4h ago•116 comments

Agent harnesses need their eBPF

https://ut-infraai.github.io/2026/12/01/agent-harnesses-need-their-ebpf/
248•ronyw7•13h ago•66 comments

Adobe nukes lifetime Acrobat Pro 2020 licenses

https://community.adobe.com/questions-9/adobe-acrobat-pro-2020-perpetual-license-won-t-active-sin...
74•JamesHist•1h ago•42 comments

The E-ink Computing Challenge

https://riddle.press/the-e-ink-computing-challenge/
250•wilabroard•2d ago•135 comments

HTML esoterica – en-GB vs. en_GB

https://www.htmhell.dev/adventcalendar/2026/1/
131•edent•2d ago•35 comments

Jiga (YC W21) Is Hiring Staff Product Manager to Make Manufacturing Great Again

https://jiga.io/about-us/
1•grmmph•10h ago

Tiny UV light chip could help shrink quantum computers

https://www.sciencedaily.com/releases/2026/11/261126063333.htm
48•gmays•2d ago•15 comments

Why the NSA Wants You to Hurry

https://unmitigatedrisk.com/2026/12/why-the-nsa-wants-you-to-hurry/
201•hasheddan•16h ago•105 comments

Creating Logic Using Waves: Photonic Gates [video]

https://www.youtube.com/watch?v=ln0zZcQXv38
40•surprisetalk•3d ago•2 comments

Post Quantum WireGuard, WireGuard v2, ongoing AI discoveries, and so forth

https://lists.zx2c4.com/pipermail/wireguard/2026-December/009817.html
959•cpach•20h ago•216 comments

After a year of tinkering, my factory is finally running smoothly

https://twitter.com/Steve_Yegge/status/2127977854944288923
312•flimp•19h ago•381 comments

The Michigan Left is a clever highway fix for cutting left-turn crashes

https://www.jalopnik.com/2329199/highway-michigan-left-turn-crashes-median-u-turn/
277•NaOH•1d ago•330 comments