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.

Escape IntelliJ: Scala and Kotlin LSPs on Emacs Eglot

https://jointhefreeworld.org/blog/articles/emacs/emacs-eglot-scala-kotlin/index.html
81•jjba23•2d ago•49 comments

Code mode yields a 99.2% cost reduction in our systems

https://www.agent-swarm.dev/blog/code-mode-token-savings
7•tarasyarema•1h ago•1 comments

Terence Tao's ChatGPT conversation about the Jacobian Conjecture counterexample

https://chatgpt.com/share/6a5fdc7a-d6f8-83e8-bbea-8deb42cfed56
911•gmays•17h ago•528 comments

Cruller: Bun's Zig Runtime, Continued on Zig 0.16

https://ziggit.dev/t/cruller-buns-zig-runtime-continued-on-zig-0-16/16734
69•Erenay09•5h ago•33 comments

Quality non-fiction books are the antithesis of AI slop

https://resobscura.substack.com/p/quality-non-fiction-books-are-the
384•benbreen•21h ago•145 comments

GigaToken: ~1000x faster Language model tokenization

https://github.com/marcelroed/gigatoken/
524•syrusakbary•18h ago•110 comments

Show HN: Bento - An entire PowerPoint in one HTML file (edit+view+data+collab)

https://bento.page/slides/
864•starfallg•20h ago•196 comments

ANSI escape injection in MCP servers: Hidden from humans, visible to AI

https://brightsec.com/research/detecting-ansi-escape-sequence-injection-in-mcp-servers-with-dast/
25•xgpyc2qp•2d ago•9 comments

Everyone should know SIMD

https://mitchellh.com/writing/everyone-should-know-simd
458•WadeGrimridge•17h ago•165 comments

EU fines Google €890M for competition breaches over search and apps

https://www.theguardian.com/technology/2026/jul/23/eu-fines-google-for-competition-breaches-over-...
27•Stevvo•1h ago•15 comments

Are AI labs pelicanmaxxing?

https://dylancastillo.co/posts/pelicanmaxxing.html
566•dcastm•18h ago•218 comments

git's –end-of-options Flag

https://nesbitt.io/2026/07/21/end-of-options.html
157•Erenay09•1d ago•93 comments

The Unity CLI: manage Unity from your terminal

https://unity.com/blog/meet-the-unity-cli
6•nateb2022•1d ago•0 comments

So Reddit has decided that plain HTML is unsafe

https://www.cole-k.com/2026/07/21/reddit/
494•montroser•22h ago•493 comments

Amiga 1000: Ten years ahead of its time

https://dfarq.homeip.net/amiga-1000-ten-years-ahead-of-its-time/
94•giuliomagnifico•5h ago•79 comments

Protecting our FLOSS commons from LLMs

https://blog.codeberg.org/protecting-our-floss-commons-from-llms.html
85•acmnrs•10h ago•24 comments

Making

https://beej.us/blog/data/ai-making/
376•erikschoster•19h ago•146 comments

Show HN: Cactus Hybrid: We taught Gemma 4 to know when it's wrong

https://github.com/cactus-compute/cactus-hybrid
150•HenryNdubuaku•17h ago•31 comments

The startup's Postgres survival guide

https://hatchet.run/blog/postgres-survival-guide
424•abelanger•22h ago•196 comments

Frequently Asked Questions on Expertise

https://jtpeterson.substack.com/p/faq-on-expertise
8•surprisetalk•2d ago•0 comments

Making ASCII Art in Vim

https://alexyang.dev/vim-ascii-art/
74•evakhoury•2d ago•8 comments

Why malloc always does more than I asked for?

https://ssenthilnathan3.github.io/blog/malloc/
43•nathaah3•2d ago•33 comments

Medici family mystery may be solved after more than 400 years

https://www.cnn.com/2026/07/15/science/medici-family-mystery-dna-malaria
127•effects•13h ago•37 comments

John C. Dvorak has died

https://twitter.com/na_announce/status/2079952538040672302
774•coleca•15h ago•259 comments

Malleable Computing, Emacs, and You

http://yummymelon.com/devnull/malleable-computing-emacs-and-you.html
117•kickingvegas•14h ago•32 comments

Businesses with ugly AI menu redesigns

https://blog.fiddery.com/businesses-with-ugly-ai-menu-redesigns/
314•speckx•22h ago•217 comments

Nobody knows what a used GPU cluster is worth

https://ciphertalk.substack.com/p/nobody-knows-what-a-used-gpu-cluster
241•rbanffy•1w ago•220 comments

Computing Camera Rays

https://momentsingraphics.de/CameraRays.html
7•ibobev•1w ago•0 comments

Fairphone 6 wide camera experimental Linux support

https://nondescriptpointer.com/articles/fairphone-6-wide-camera-linux/
127•helonaut•15h ago•39 comments

ascdraw: Editor for ASCII/UTF-8 diagrams (in 144FPS)

https://github.com/exlee/ascdraw
49•xlii•2d ago•10 comments