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.

Owed a billion dollars in Nvidia stock

https://colo.to/nvidia-stock-narrative.html
245•Eric_Gullichsen•2h ago•119 comments

Nissan's third generation e-POWER powertrain

https://www.nissan-global.com/EN/INNOVATION/TECHNOLOGY/ARCHIVE/E_POWER_GEN3/
20•mroche•1h ago•15 comments

Thinking Fast and Slow in AI: The Role of Metacognition

https://arxiv.org/abs/2110.01834
13•teleforce•56m ago•0 comments

Ember-1

https://fireworks.ai/blog/ember-1
388•gmays•10h ago•195 comments

When did Google get so weird?

https://sancho.bearblog.dev/google-weird/
932•sancho-panza•8h ago•505 comments

Alan Kay's answer to “Did the ENIAC have a BIOS”?

https://www.quora.com/Did-the-ENIAC-have-a-BIOS/answer/Alan-Kay-11
89•midnightfish•8h ago•31 comments

There is more to code review than (automatable) detection

https://www.adaptivecapacitylabs.com/2026/08/24/there-is-more-to-code-review-than-automatable-det...
88•utiiiD•1d ago•47 comments

The state of SIMD in Rust in 2026

https://shnatsel.github.io/state-of-simd-rust-2026/
108•verdagon•2d ago•23 comments

Musk, the Movie

https://bleeckerstreetmedia.com/musk
103•yablak•2h ago•24 comments

Show HN: Lofi Cities – Pixel-art city nights with browser-generated lofi

https://loficities.com/
196•safaelmali•9h ago•87 comments

Malleable software: Restoring user agency in a world of locked-down apps (2025)

https://www.inkandswitch.com/essay/malleable-software/
16•evakhoury•9h ago•3 comments

Lunar Terminator Paradox

https://notes.secretsauce.net/notes/2026/09/27_lunar-terminator-paradox.html
56•dima55•7h ago•38 comments

Don't couple your Go code to GitHub

https://iain.rocks/blog/dont-couple-your-go-code-to-github
171•birdculture•11h ago•84 comments

As A.I. makes law firms more efficient, clients ask: 'Where's my discount?'

https://www.nytimes.com/2026/09/26/business/dealbook/ai-law-discount-billable-hour.html
67•mooreds•2h ago•48 comments

Microsoft drops Copilot+ branding from its new laptops

https://www.tomshardware.com/tablets/microsoft-surface/microsoft-quietly-drops-copilot-branding-f...
23•anthuswilliams•1h ago•6 comments

Self-Hosting on the Dark Web

https://david.alvarezrosa.com/posts/self-hosting-on-the-dark-web/
93•mooreds•8h ago•32 comments

TabPFN and TabICL vs. tuned XGBoost: the model that doesn't train won 14/14

https://efraingaray.com/en/blog/tabpfn-vs-xgboost/
5•EfrainGaray•1h ago•3 comments

What I did at Recurse Center

https://thill.me/2026/09/11/what-i-did-at-rc.html
83•bingden•9h ago•25 comments

Deterministic Concurrency [video]

https://www.youtube.com/watch?v=25x0UuSCKuU
3•surprisetalk•2d ago•0 comments

Imp is a full port of DSPy to the BEAM

https://github.com/deepfates/imp
59•mpweiher•8h ago•6 comments

Guitar amp and effects pedal built on the Waveshare ESP32-S3-Touch-AMOLED-2.06

https://github.com/dashersw/coyopedal
33•arbayi•2d ago•11 comments

In an $80 motel room, a discovery to shed light on the origins of life

https://www.nytimes.com/2026/09/26/science/motel-science-discovery.html
220•danso•13h ago•83 comments

Replacing the old battery on rechargeable bike lights

https://jvns.ca/blog/2026/09/27/replacing-the-old-battery-on-rechargeable-bike-lights/
146•surprisetalk•14h ago•80 comments

Previously unheard recordings of John Coltrane, captured by Frank Tiberi

https://www.jazzwise.com/content/news/john-coltrane-centenary-celebrations-see-impulse-records-re...
75•gregsadetsky•2d ago•28 comments

Research finds 485 chemicals in US pesticide products linked to breast cancer

https://www.theguardian.com/us-news/2026/sep/26/breast-cancer-us-pesticide-products
62•Teever•2h ago•21 comments

Oral history of John Chowning, inventor of FM synthesis [video]

https://www.youtube.com/watch?v=e1Xn3030IvM
59•Rochus•10h ago•13 comments

Writing Efficient C++ Code (2013)

https://asawicki.info/articles/writing_efficient_cpp_code.php
140•ibobev•2d ago•85 comments

A New Experiment Meta-Strategy

https://chillphysicsenjoyer.substack.com/p/a-new-experiment-meta-strategy
17•surprisetalk•2d ago•0 comments

The Cartesian Hand: In-Hand Manipulation with All-Linear Fingers

https://generalroboticslab.com/cartesian_handv1
72•AareyBaba•1d ago•11 comments

Fakecloud: Local AWS cloud emulator for integration tests

https://fakecloud.dev/
122•theanonymousone•1d ago•63 comments