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.

Einstein's relativity rules chemical bonds in heavy elements, new research shows

https://www.brown.edu/news/2026-07-09/chemical-bonds-relativity
231•hhs•10h ago•79 comments

QuadRF can spot drones and see WiFi through my wall

https://www.jeffgeerling.com/blog/2026/quadrf-can-spot-drones-and-see-wifi-through-my-wall/
574•speckx•17h ago•192 comments

Apple sues OpenAI, accuses ex-employees of stealing trade secrets

https://9to5mac.com/2026/07/10/apple-sues-openai-trade-secret-theft/
1035•stock_toaster•12h ago•523 comments

The vintage beauty of Soviet control rooms (2018)

https://designyoutrust.com/2018/01/vintage-beauty-soviet-control-rooms/
87•mvdtnz•3h ago•27 comments

An iroh powered smart fan

https://www.iroh.computer/blog/an-iroh-powered-smart-fan
102•surprisetalk•3d ago•26 comments

An update on residential proxies and the scraper situation

https://lwn.net/SubscriberLink/1080822/990a8a5e2d379085/
190•chmaynard•13h ago•180 comments

Otary – Image and Geometry Python Library Now Has Tutorials

https://alexandrepoupeau.com/otary/learn/
7•poupeaua•2d ago•0 comments

SpaceX wants to launch 100k more Starlink satellites for 100x the bandwidth

https://www.zdnet.com/home-and-office/networking/spacex-wants-to-launch-100000-more-starlink-sate...
178•CrankyBear•15h ago•582 comments

Silent speech with ultrasound

https://alephneuro.com/blog/silent-speech
52•chrwn•3d ago•12 comments

Good Tools Are Invisible

https://www.gingerbill.org/article/2026/07/10/good-tools-are-invisible/
426•theanonymousone•22h ago•195 comments

AI 2040: Plan A

https://ai-2040.com/
258•kschaul•1d ago•258 comments

Documentation is still in your Mum's filing cabinet

https://gerireid.com/blog/organising-documentation-for-humans-and-ai/
18•mooreds•3d ago•4 comments

The tech of 'Terminator 2' – an oral history (2017)

https://vfxblog.com/2017/08/23/the-tech-of-terminator-2-an-oral-history/
215•markus_zhang•16h ago•76 comments

Combustion engine web-based simulator

https://combustionlab.net
166•mytuny•5d ago•67 comments

The Lindy effect in software

https://www.clemsau.com/posts/the-lindy-effect-in-software/
19•ankitg12•3d ago•15 comments

Late Bronze Age Collapse

https://acoup.blog/2026/01/30/collections-the-late-bronze-age-collapse-a-very-brief-introduction/
366•dmonay•21h ago•250 comments

GPT-5.6 Sol Ultra produces proof of the Cycle Double Cover Conjecture [pdf]

https://cdn.openai.com/pdf/04d1d1e4-bc75-476a-97cf-49055cd98d31/cdc_proof.pdf
450•scrlk•14h ago•362 comments

Inference Optimization for MiMo v2.5: Pushing Hybrid SWA Efficiency to the Limit

https://mimo.xiaomi.com/blog/mimo-v2-5-inference
74•theanonymousone•4d ago•29 comments

After 7 years in production, Scarf has reluctantly moved away from Haskell

https://avi.press/posts/2026-07-10-after-7-years-in-production-scarf-has-reluctantly-moved-away-f...
134•aviaviavi•19h ago•167 comments

Computation as a universal and fundamental concept

https://ergo.org/courses/computation-as-a-universal-and-fundamental-concept
129•simonpure•17h ago•92 comments

Alternate clock designs and time systems

https://serialc.github.io/altClocks/
139•ethanpil•4d ago•79 comments

New York City to ban deceptive subscription practices

https://www.theguardian.com/us-news/2026/jul/10/new-york-city-deceptive-subscriptions-ban
512•randycupertino•14h ago•250 comments

Snails' teeth beats spider silk as nature's strongest material (2015)

https://www.smithsonianmag.com/smart-news/spider-silk-loses-top-spot-natures-strongest-material-s...
187•simonebrunozzi•16h ago•144 comments

A love letter to flashcards

https://lesleylai.info/en/flashcards/
153•surprisetalk•17h ago•97 comments

Lost city discovered beneath Egypt's desert with ancient church

https://www.dailymail.com/sciencetech/article-15956159/Incredible-lost-city-discovered-Egypts-des...
180•Bender•4d ago•125 comments

Moss (YC F25) Is Hiring

https://www.ycombinator.com/companies/moss/jobs/52LnqLQ-software-engineer-sdk
1•srimalireddi•12h ago

Show HN: Getting GLM 5.2 running on my slow computer

https://github.com/JustVugg/colibri
852•vforno•2d ago•211 comments

Companies are scrambling to curtail soaring AI costs

https://www.economist.com/business/2026/06/14/companies-are-scrambling-to-curtail-soaring-ai-costs
20•nlpnerd•46m ago•7 comments

Preemption is GC for memory reordering (2019)

https://pvk.ca/Blog/2019/01/09/preemption-is-gc-for-memory-reordering/
32•mpweiher•2d ago•6 comments

War Atlas: An interactive cartography of every named war in human history

https://waratlas.org
150•NaOH•15h ago•66 comments