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.

Civic Hygiene – avoid building technologies that could be used by a police state

https://shkspr.mobi/blog/2013/11/civic-hygiene/
76•felineflock•27m ago•22 comments

Geolocating a random island using geometry and CUDA programming

https://yassa9.github.io/osint/gralhix-004/
226•yassa9•4h ago•46 comments

A joke domain purchase turned in geopolitical warfare

https://sprocketfox.io/xssfox/2026/08/19/sondehub-and-war/
300•kareiva•5h ago•40 comments

OpenLogi

https://openlogi.org/en
1284•amatheus•14h ago•355 comments

PostgreSQL for Everything

https://www.raphaelbauer.com:443/posts/postgresql-everything/
151•karlmush•3h ago•103 comments

Microgpt in pure C hits 10M tps on Apple m5

https://github.com/vixhal-baraiya/microgpt-c
42•dhorthy•1d ago•6 comments

Devices with GrapheneOS support should be available in 2027

https://grapheneos.social/@GrapheneOS/117078064184215730
443•exceptione•4h ago•265 comments

Moderna reports first positive Phase 3 for mRNA neoantigen therapy in melanoma

https://twitter.com/NoubarAfeyan/status/2090050162441752787
257•heydenberk•3h ago•106 comments

Launch HN: OneCLI (YC S26) – OSS sandboxed agent harness for teams

https://github.com/onecli/onecli
2•guyb3•5m ago•0 comments

Ornith-1.5: From Self-Scaffolding to Self-Improvement

https://ornith.ai/ornith_1_5.html
21•CommonGuy•1h ago•2 comments

Remote workers report the highest well-being in study of 7,700 employees

https://www.colorado.edu/today/2026/08/12/remote-workers-report-highest-well-being-study-7700-emp...
66•downbad_•1h ago•26 comments

Air Theremin – a browser theremin you play by waving at your webcam

https://theremin.bizibah.com/
162•gurov•6h ago•65 comments

Taffy: A flexible, high-performance, cross-platform UI layout library

https://github.com/DioxusLabs/taffy
57•robin_reala•6d ago•23 comments

New Casio F-B100W – Upgrade to the iconic F-91W after 40 years

https://www.casio.com/uk/watches/casio/product.F-B100W-1A/
69•__fst__•1h ago•50 comments

A decades-old bug in Knuth's long division (TAOCP Vol II, Algorithm 4.3.1D)

https://kolja.rs/algorithm-d/
101•nk_kolja•6d ago•20 comments

Cerebras CS-4

https://www.cerebras.ai/cs4
406•sunils34•16h ago•245 comments

Rings forged from meteorites may have been fashionable among ancient Greek elite

https://phys.org/news/2026-08-forged-meteorites-fashionable-ancient-greek.html
84•pseudolus•5d ago•35 comments

Being ambitious and being a dad

https://nicholascharriere.com/blog/being-ambitious-and-being-a-dad/
785•nichochar•3d ago•592 comments

Supersonic Trebuchet [video]

https://www.youtube.com/watch?v=Co57SfcT-h0
206•CharlesW•4d ago•92 comments

Activation Energy is a good model for a lot of things

https://homosabiens.substack.com/p/activation-energy-is-a-good-model
114•surprisetalk•5d ago•29 comments

Palomar: A registry of Lean verified mathematics

https://terrytao.wordpress.com/2026/08/18/palomar-a-registry-of-lean-verified-mathematics/
153•matt_d•13h ago•37 comments

A 3D fruit fly on macOS desktop powered by the real FlyWire connectome

https://github.com/DenisSergeevitch/desktop-fly
354•phoenix120•18h ago•163 comments

Mathematics in the Age of AI

https://arxiv.org/abs/2608.16753
4•jonbaer•1h ago•1 comments

How does IKEA come up with names for its products?

https://www.ikea.com/se/en/customer-service/knowledge/articles/6f564c4d-2ccc-46de-b643-545a3948dc...
426•NaOH•22h ago•303 comments

λλ: A Programming Language for Silicon Photonics

https://dl.acm.org/doi/10.1145/3789240.3829151
73•matt_d•10h ago•16 comments

Show HN: Nikon F100 Film Camera Repair Notes

https://github.com/enthdegree/f100
22•enthdegree•4d ago•11 comments

Finger: the 1971 social network that never died

https://en.andros.dev/blog/54572bc7/finger-the-1971-social-network-that-never-died/
293•andros•1d ago•98 comments

A 25-year-old video patent just expired, ending a legal headache for Linux

https://www.xda-developers.com/25-year-old-brazilian-video-patent-expired-legal-headache-linux/
287•theanonymousone•4d ago•142 comments

Claude writing a macOS driver for my obscure HP printer built only for Windows

https://twitter.com/kuberwastaken/status/2089377982536388964
286•porridgeraisin•1d ago•206 comments

The Mojo language (by Modular, now Qualcomm) is now open-source

https://www.modular.com/blog/modcon-announcements
190•flaburgan•8h ago•93 comments