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.

Om Malik has died

https://om.co/2026/06/24/1966-2026/
702•minimaxir•8h ago•68 comments

An entire Herculaneum scroll has been read for the first time

https://scrollprize.org/firstscroll
1123•verditelabs•13h ago•235 comments

Libre Barcode Project

https://graphicore.github.io/librebarcode/
49•luu•2h ago•2 comments

Framework's 10G Ethernet module exposes USB-C's complexity

https://www.jeffgeerling.com/blog/2026/framework-10g-ethernet-module-usb-c-complexity/
101•Alupis•4h ago•41 comments

What happened after 2k people tried to hack my AI assistant

https://www.fernandoi.cl/posts/hackmyclaw/
39•cuchoi•2h ago•6 comments

The 'papers, please' era of the internet will decimate your privacy

https://expression.fire.org/p/the-papers-please-era-of-the-internet
549•bilsbie•7h ago•246 comments

Apple to skip high-end M6 Mac chips in favor of AI-focused M7 line

https://www.bloomberg.com/news/articles/2026-06-25/apple-to-skip-high-end-m6-mac-chips-to-launch-...
173•scrlk•11h ago•137 comments

Overfitted a 900KB Transformer to Compress a 100MB CSV into 7MB

66•spidy__•2d ago•31 comments

The Garbage Collection Handbook: The Art of Automatic Memory Management (2nd Ed) (2023)

https://gchandbook.org/
88•teleforce•6h ago•12 comments

Oxide computer 3D rack guided tour

https://explorer.oxide.computer/
336•darthcloud•3d ago•128 comments

A game where you're an OS and have to manage processes, memory and I/O events

https://github.com/plbrault/youre-the-os
142•exploraz•2d ago•26 comments

Un-0: Generating Images with Coupled Oscillators

https://unconv.ai/blog/introducing-un-0-generating-images-with-coupled-oscillators/
131•babelfish•8h ago•32 comments

IBM debuts sub-1 nanometer chip technology

https://newsroom.ibm.com/2026-06-25-ibm-debuts-worlds-first-sub-1-nanometer-chip-technology
291•porridgeraisin•13h ago•159 comments

Show HN: OpenKnowledge – open source AI-first alternative to Obsidian/Notion

https://github.com/inkeep/open-knowledge
237•engomez•13h ago•113 comments

Doing a masters while working in Spain

https://jan-herlyn.com/blog/doing-a-masters-while-working/
16•MHard•3d ago•1 comments

Eyewitness at the Triangle (1911)

http://trianglefire.ilr.cornell.edu/index.html
16•NaOH•3d ago•1 comments

Show HN: Chess-Inspired Roguelike

https://princechazz.com
250•cowboy_henk•4d ago•83 comments

An oral history of Bank Python (2021)

https://calpaterson.com/bank-python.html
92•tosh•9h ago•27 comments

The Doorman's Fallacy in action

https://rozumem.xyz/posts/17
85•rozumem•9h ago•115 comments

Parallel Parentheses Matching

https://williamdue.github.io/blog/parallel-parentheses-matching
73•Athas•9h ago•9 comments

OS9Map

https://yllan.org/software/OS9Map/
209•LaSombra•14h ago•40 comments

Zig's new bitCast semantics and LLVM back end improvements

https://ziglang.org/devlog/2026/#2026-06-25
223•kouosi•15h ago•108 comments

Apple raises prices of MacBooks, iPads

https://www.reuters.com/world/asia-pacific/apple-raises-prices-macbooks-ipads-memory-costs-skyroc...
675•virgildotcodes•16h ago•972 comments

Experiments in Sports Seismology for the World Cup

https://pnsn.org/blog/experiments-in-sports-seismology-for-the-world-cup
17•jmward01•4d ago•0 comments

Record type inference for dummies

http://haskellforall.com/2026/06/record-type-inference-for-dummies
27•g0xA52A2A•2d ago•0 comments

The last Romans are still around

https://signoregalilei.com/2026/06/20/the-last-romans-are-still-around/
61•surprisetalk•3d ago•79 comments

You can't unit test for taste

https://dev.karltryggvason.com/you-cant-unit-test-for-taste/
261•kalli•1d ago•118 comments

Besimple AI (YC P25) Is Hiring

https://www.ycombinator.com/companies/besimple-ai/jobs/yWfhhOR-strategic-projects-lead-audio-data
1•yzhong94•12h ago

A data race that doesn't compile

https://corentin-core.github.io/posts/ruxe-type-level-disjointness/
23•stmw•3h ago•6 comments

Hey Nico, you didn't vibe code your data room but stole it from Papermark

https://twitter.com/mfts0/status/2070080422482977095
240•mmunj•17h ago•95 comments