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.

Shadcn/UI now defaults to Base UI instead of Radix

https://ui.shadcn.com/docs/changelog
110•dabinat•4h ago•33 comments

sqlite-utils 4.0rc2, mostly written by Claude Fable (for about $149.25)

https://simonwillison.net/2026/Jul/5/sqlite-utils-fable/
40•ognyankulev•2h ago•32 comments

Command and Conquer Generals natively ported to macOS, iPhone, iPad using Fable

https://github.com/ammaarreshi/Generals-Mac-iOS-iPad/tree/main
554•asronline•13h ago•224 comments

If you're a button, you have one job

https://unsung.aresluna.org/if-youre-a-button-you-have-one-job/
184•nozzlegear•7h ago•88 comments

Pandoc Lua Filters

https://pandoc.org/lua-filters.html
58•ankitg12•1d ago•1 comments

GPT-5.5 Codex reasoning-token clustering may be leading to degraded performance

https://github.com/openai/codex/issues/30364
260•maille•11h ago•98 comments

Apocketlypse

https://0dd.company/galleries/triumph/1.html
5•scaglio•29m ago•0 comments

Megawatts by Microwave

https://computer.rip/2026-07-04-microwave-and-power.html
20•eternauta3k•3h ago•2 comments

Is The Economist Always Wrong?

https://economist.com/interactive/finance-and-economics/2026/07/02/is-the-economist-always-wrong
21•andsoitis•2h ago•21 comments

Jellyfish can heal wounds in minutes. Scientists want their secrets

https://www.mbl.edu/news/jellyfish-can-heal-wounds-minutes-scientists-want-their-secrets
115•hhs•10h ago•23 comments

Google Books (or similar) all book scans – $200k bounty (2025)

https://software.annas-archive.gl/AnnaArchivist/annas-archive/-/work_items/234
456•Cider9986•16h ago•243 comments

Leaking YouTube creators' private videos

https://javoriuski.com/post/youtube
604•javxfps•16h ago•329 comments

Moby Dick Workout

https://www.hogbaysoftware.com/posts/moby-dick-workout/
38•helloplanets•4h ago•12 comments

Artful Cats: Feline-Inspired Art and Artifacts

https://www.si.edu/spotlight/art-cats
38•jruohonen•3d ago•4 comments

Atomic Force Microscope high-speed video, stainless etching, bacteria, and more

https://www.youtube.com/watch?v=DyIQkqBXhS0
69•mhb•2d ago•5 comments

Better Models: Worse Tools

https://lucumr.pocoo.org/2026/7/4/better-models-worse-tools/
166•leemoore•12h ago•55 comments

The Log Is the Agent

https://arxiv.org/abs/2605.21997
38•iacguy•6h ago•9 comments

Return of the Nigerian Prince Redux: Beware Book Club and Book Review Scams (2025)

https://writerbeware.blog/2025/09/19/return-of-the-nigerian-prince-redux-beware-book-club-and-boo...
52•Anon84•8h ago•12 comments

EV Batteries Are Defying Expectations After Miles

https://www.wsj.com/business/autos/ev-batteries-are-defying-expectations-after-hundreds-of-thousa...
37•apparent•2h ago•26 comments

Meta's Un-Stable Signature

https://hackerfactor.com/blog/index.php?/archives/1098-Metas-Un-Stable-Signature.html
82•ementally•3d ago•9 comments

My ASN Journey series (2024)

https://www.animmouse.com/p/my-asn-journey/
17•antonalekseev•4h ago•5 comments

Potential session/cache leakage between workspace instances or consumer accounts

https://github.com/anthropics/claude-code/issues/74066
294•chatmasta•18h ago•130 comments

Zig: All Package Management Functionality Moved from Compiler to Build System

https://ziglang.org/devlog/2026/#2026-06-30
190•tosh•16h ago•61 comments

"Beyond the limit": Satellites and mirrors in space pose threat to the night sky

https://www.eso.org/public/news/eso2607/
142•Breadmaker•15h ago•234 comments

A Summer of Solar Cooking (2023)

https://100r.ca/site/solar_cooking_experiment.html
3•surprisetalk•1d ago•0 comments

Record-breaking solo rower Kelsey Pfendler arrives in Hawaii

https://www.hawaiinewsnow.com/2026/07/04/record-breaking-solo-rower-kelsey-pfendler-arrives-hawaii/
45•MaysonL•7h ago•5 comments

What ORMs have taught me: just learn SQL (2014)

https://wozniak.ca/blog/2014/08/03/1/index.html
185•ciconia•4d ago•213 comments

The Particle Box – Kinetic Molecular Theory Simulator

https://prepok.com/chemistry/particle-box/
11•vaibhav1312•3d ago•1 comments

The Preemptive Draw and Preemptive Grip in the Cash-in-Transit Sector

https://gutsgatesguards.wordpress.com/2026/06/23/the-preemptive-draw-and-preemptive-grip-in-the-c...
12•stmw•5h ago•1 comments

Width vs. Depth: Speculating on the Margin

https://blog.doubleword.ai/speculating-on-the-margin
8•somnial•2d ago•1 comments