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.

Android 17 is the first since 3.x to add new APIs without releasing to the AOSP

https://grapheneos.social/@GrapheneOS/117282080803799576
566•theanonymousone•7h ago•267 comments

Cloudflare Quick Tunnels

https://try.cloudflare.com/
594•jcbhmr•12h ago•253 comments

Saving another 100TB of RAM

https://blog.cloudflare.com/saving-100-tb-of-ram-with-math/
241•f311a•7h ago•45 comments

The Farnese letter

https://simonklee.dk/farnese-letter
30•grigolin•1d ago•5 comments

How to Write with an LLM

https://sockpuppet.org/blog/2026/09/17/how-to-write-with-an-llm/
401•joeriddles•1d ago•274 comments

Xcode 27.1 Beta Release Notes

https://developer.apple.com/documentation/xcode-release-notes/xcode-27_1-release-notes
116•CameronBanga•7h ago•68 comments

Show HN: LiveWorld – Every 24/7 YouTube live camera on one globe

https://liveworld.info/
13•harisingh1612•1h ago•10 comments

Photon-Emission-Guided Laser Fault Injection Enables RP2350 Secure Debug

https://donjon.ledger.com/blog/rp2350-secure-debug-laser-fault-injection/
160•synack•9h ago•54 comments

Show HN: Cactus Needle 3: 8-29MB automation models can match DeepSeek V4 Flash

https://cactuscompute.com/needle
166•HenryNdubuaku•1d ago•78 comments

The first new cat species discovered in 100 years

https://www.nationalgeographic.com/animals/article/meet-the-first-new-cat-species-discovered-in-1...
179•ohjeez•1d ago•62 comments

Cache-to-Cache: Direct Semantic Communication Between LLMs (2025)

https://arxiv.org/abs/2510.03215
69•rochansinha•7h ago•12 comments

OpenJev

https://openjev.com/
561•ilreb•16h ago•247 comments

How OpenAI Used Its Own LLMs to Design Its Jalapeño Chip

https://spectrum.ieee.org/llms-for-chip-design
61•maxall4•3h ago•60 comments

Claude Code now reads AGENTS.md if there is no Claude.md

https://code.claude.com/docs/en/changelog
529•datadrivenangel•5h ago•187 comments

Cyclomatic Complexity in C#

https://blog.ndepend.com/understanding-cyclomatic-complexity/
34•gone35•2d ago•15 comments

LispBM is a concurrent Lisp for microcontrollers with message passing

https://www.lispbm.com/
10•so-cal-schemer•2d ago•1 comments

Why building a Rust LSP is hard

https://rust-glancer.github.io/blog/why-lsp-is-hard/
3•agluszak•2d ago•0 comments

Minimal Phone 2

https://minimalcompany.com/
194•nashashmi•1d ago•187 comments

Warez: The Infrastructure and Aesthetics of Piracy (2021)

https://archive.org/details/b904a8eb-9c98-4bb1-bf25-3cb9d075b157
112•succinct_ideas•23h ago•29 comments

Two parallel neural ectoderm progenitors contribute to the developing brain

https://www.newscientist.com/article/2589739-our-brain-evolved-from-two-primitive-nervous-systems...
105•Jimmc414•11h ago•56 comments

The Implications of Linguistic Illegibility for LLM Security

https://arxiv.org/abs/2609.02852
53•tomjakubowski•7h ago•20 comments

Inside ZCode: Silently uploading your Git history to the cloud

https://blog.ferstar.org/en/posts/zcode-silent-workspace-snapshot-upload/
259•csmantle•20h ago•93 comments

Alibaba open-sources AI model that can detect cancer and nearly 150 conditions

https://www.scmp.com/tech/big-tech/article/3368055/alibaba-open-sources-medical-ai-model-can-dete...
30•yogthos•2h ago•4 comments

C++26: Trivial infinite loops are no longer undefined behaviour

https://www.sandordargo.com/blog/2026/09/16/cpp26-trivial-infinite-loops
149•ibobev•1d ago•203 comments

How SpaceX streamlined the Raptor engine

https://www.construction-physics.com/p/how-spacex-streamlined-the-raptor
166•JumpCrisscross•1d ago•43 comments

Column built an issuer processor from scratch

https://column.com/card-issuing/
22•Matthalp•2d ago•5 comments

A search-and-inference database from scratch in pure Zig

https://antfly.io/research/antfly-zig
54•kingcauchy•3d ago•16 comments

I vibed a proof of Conway's conjecture

https://overreacted.io/how-i-vibed-a-proof-of-conways-conjecture/
214•m-hodges•11h ago•186 comments

Size-Specialized Memory Allocation

https://go.dev/blog/size-specialized-allocations
18•spacey•2d ago•3 comments

North Korean nuclear test sets off years of earthquakes

https://www.science.org/content/article/north-korean-nuclear-test-sets-years-earthquakes
184•rbanffy•11h ago•152 comments