frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

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.

Astronauts told to return to ISS after sheltering over air leak repairs

https://www.bbc.com/news/live/c4g44ew3g1kt
295•janpot•5h ago•194 comments

pg_durable: Microsoft open sources in-database durable execution

https://github.com/microsoft/pg_durable
213•coffeemug•4h ago•47 comments

Gemma 4 QAT models: Optimizing compression for mobile and laptop efficiency

https://blog.google/innovation-and-ai/technology/developers-tools/quantization-aware-training-gem...
171•theanonymousone•4h ago•33 comments

Three of our worst VC stories

https://twitter.com/eastdakota/status/2062860530360959273
47•orgonon•1h ago•11 comments

My Agent Skill for Test-Driven Development

https://www.saturnci.com/my-agent-skill-for-test-driven-development.html
54•laxmena•1d ago•12 comments

New method turns ocean water into drinking water, without waste

https://www.rochester.edu/newscenter/what-is-desalination-definition-ocean-water-704732/
119•speckx•5h ago•61 comments

Mouseless – keyboard-driven control of macOS/Linux/Windows

https://mouseless.click
367•riddley•2d ago•166 comments

Transformers Are Inherently Succinct

https://openreview.net/pdf?id=Yxz92UuPLQ
29•brandonb•1h ago•9 comments

Conventional Commits encourages focus on the wrong things

https://sumnerevans.com/posts/software-engineering/stop-using-conventional-commits/
197•jsve•4h ago•159 comments

Gov.uk has replaced Stripe with Dutch provider Adyen

https://www.theregister.com/public-sector/2026/06/04/govuk-goes-dutch-on-payments-as-it-dumps-str...
181•toomuchtodo•3h ago•43 comments

Accidentally deleted subscriptions for chat integrations (Slack and MS Teams)

https://www.githubstatus.com/incidents/2nmfnbknhlnv
76•SparkyDogs•1h ago•32 comments

I tested every IP KVM in my Homelab

https://www.jeffgeerling.com/blog/2026/i-tested-every-ip-kvm/
179•vquemener•6h ago•49 comments

Did Claude increase bugs in rsync?

https://alexispurslane.github.io/rsync-analysis/
171•logicprog•7h ago•172 comments

Do the Hardest Thing

https://justinjackson.ca/hard-thing
51•levhawk•1d ago•29 comments

"Maybe later" was a feature

https://arnorhs.dev/posts/2026-06-04/maybe-later-was-a-feature/
29•arnorhs•1d ago•4 comments

Cooldown Support for Ruby Bundler

https://blog.rubygems.org/2026/06/03/cooldown-let-new-gems-be-vetted.html
126•calyhre•2d ago•30 comments

Launch HN: General Instinct (YC P26) – Frontier models on edge devices

32•guanming0717•4h ago•10 comments

Ask HN: What was your "oh shit" moment with GenAI?

29•andrehacker•20h ago•79 comments

Mantine-datatable (and others) compromised – owner account suspended

https://github.com/icflorescu/mantine-datatable/discussions/813
47•justsomehuman•3h ago•16 comments

Inside FAISS: Billion-Scale Similarity Search

https://fremaconsulting.ch/blog/faiss
18•tohms•1d ago•0 comments

Tracing a powerful GNSS interference source over Europe

https://arxiv.org/abs/2606.03673
324•mimorigasaka•12h ago•177 comments

Google to pay SpaceX $920M a month for compute capacity at xAI data centers

https://www.cnbc.com/2026/06/05/google-to-pay-spacex-920-million-a-month-for-xai-compute-capacity...
21•toephu2•28m ago•1 comments

Nango (YC W23, dev infra) is hiring staff back end engineers

https://nango.dev/careers
1•bastienbeurier•8h ago

India's surprise baby bust

https://www.economist.com/leaders/2026/06/04/indias-surprise-baby-bust-is-a-warning-to-the-world
68•hakonbogen•5h ago•332 comments

Redis 8.8: New array data structure, rate limiter, performance improvements

https://redis.io/blog/announcing-redis-8-8/
183•ksec•2d ago•83 comments

Dutch gov't will only allow European company to operate DigiD platform

https://nltimes.nl/2026/06/05/dutch-govt-will-allow-european-company-operate-digid-platform
205•TechTechTech•5h ago•66 comments

C++: The Documentary

https://herbsutter.com/2026/06/04/c-the-documentary-released-today/
335•ingve•15h ago•245 comments

Let's celebrate work that is 100% human-made

https://www.human-made.work/
16•supryan•4h ago•5 comments

Show HN: Lowfat – pluggable CLI filter that saved 91.8% of my LLM tokens

https://github.com/zdk/lowfat
77•zdkaster•11h ago•46 comments

Entanglement Builds Space-Time. Now "Magic" Gives It Gravity

https://www.quantamagazine.org/entanglement-builds-space-time-now-magic-gives-it-gravity-20260603/
155•rbanffy•12h ago•144 comments