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.

Git for the US Code

https://lexifina.com/blog/git-for-the-us-code
269•alansaber•8h ago•137 comments

Genie 4

https://deepmind.google/blog/genie-4-a-new-generation-of-world-simulation/
901•acossta•18h ago•517 comments

Ghostty 1.4

https://ghostty.org/docs/install/release-notes/1-4-0
1034•deaux•17h ago•331 comments

Ink droplets in motion snag top prize in Nikon Small World contest

https://arstechnica.com/science/2026/10/meet-the-2026-winner-of-nikons-small-world-photomicrograp...
238•_Microft•2d ago•41 comments

Start Doing Graph Theory

https://vertex.degree/
30•ibobev•4d ago•0 comments

MacOS Extensions Pack for the Apple Network Server v1.0

http://oldvcr.blogspot.com/2026/10/macos-extensions-pack-for-apple-network.html
50•classichasclass•3d ago•0 comments

Survival LLM: AI assistant and emergency library that runs on your own computer

https://www.brangus.io/survival-llm
350•Luc•14h ago•141 comments

Tailscale SSH: Investigation and remediation update

https://tailscale.com/ssh-investigation-update
287•figmert•14h ago•148 comments

Early progress on accelerating drug development with Claude

https://www.anthropic.com/research/early-progress-drug-development
229•dataking•13h ago•219 comments

Decompiling Fast Food Tycoon 2: Drawing the World

https://healeycodes.com/decompiling-fast-food-tycoon-2-drawing-the-world
40•healeycodes•3d ago•7 comments

Python's experimental JIT to be removed

https://lwn.net/SubscriberLink/1102102/0c00e4d550f25f8c/
511•f311a•22h ago•277 comments

Raspberry Pi Zero 3W and Pi 4 Model A spotted in device trees

https://bret.dk/raspberry-pi-zero-3-w-pi-4-model-a/
169•sthlmb•13h ago•90 comments

New 14‑inch MacBook Pro with M6

https://www.apple.com/in/newsroom/2026/10/apple-introduces-the-new-14-inch-macbook-pro-with-m6/
362•beex•18h ago•494 comments

Code-execution flaw in UEFI firmware threatens most servers on planet Earth

https://arstechnica.com/security/2026/10/code-execution-flaw-in-uefi-firmware-threatens-most-serv...
144•DamnInteresting•13h ago•74 comments

SS United States to be sunk as largest artificial reef

https://divemagazine.com/scuba-diving-news/ss-united-states-to-be-sunk-as-worlds-largest-artifici...
148•geox•2d ago•119 comments

Closing the Sea: Lessons from Ancient Mediterranean Blockades

https://maritime-executive.com/editorials/closing-the-sea-lessons-from-ancient-mediterranean-bloc...
12•gumby•2d ago•0 comments

New iMac with M6

https://www.apple.com/imac/
336•notfried•21h ago•425 comments

Jokes for the ZX81

https://spelk.press/gb/products/81-jokes-for-the-zx81
94•robin_reala•1d ago•11 comments

Four Months of Zig

https://gracefulliberty.com/articles/four-months-of-zig/
128•ibobev•13h ago•83 comments

Classification of Finite Simple Groups Formalized in Lean

https://cfsg.axiommath.ai/
212•pfdietz•17h ago•59 comments

A Love Letter to the Super Dimension Fortress

https://brennan.day/a-love-letter-to-the-super-dimension-fortress/
57•jruohonen•4d ago•9 comments

An examination of lost firefly species of the US and Canada

https://journaloflostspecies.org/index.php/jls/article/view/37/33
126•bryanrasmussen•3d ago•41 comments

Hunger beats tenure: Advice for junior engineers

https://felixrieseberg.com/hunger-beats-tenure-advice-for-junior-engineers/
75•akavi•11h ago•47 comments

Assembly Nights (2021)

https://ratfactor.com/assembly-nights
53•andsoitis•2d ago•11 comments

US Government is hiding a secret court ruling about how it spies on Americans

https://www.wired.com/story/the-us-government-is-hiding-a-secret-court-ruling-about-how-it-spies-...
941•helterskelter2•20h ago•345 comments

Moxnox 1.0: NT-Like, POSIX-Compatible OS Running Atop Btrfs

https://github.com/maharmstone/moxnox
68•SockThief•10h ago•14 comments

State of ARM Support for Puget Bench

https://www.pugetsystems.com/blog/2026/10/22/state-of-arm-support-for-puget-bench/
7•zdw•5d ago•0 comments

Why Micron Is Suddenly Ditching 4F² DRAM as Rivals Double Down

https://hothardware.com/news/why-micron-is-suddenly-ditching-4f-dram
168•rbanffy•1d ago•26 comments

Radio-tagged Monarch butterflies

https://news.vt.edu/articles/2026/10/cmi-monarchs.html
61•rdmuser•16h ago•18 comments

Spain train crash: 'At least 10 dead' in high-speed collision

https://www.thetimes.com/world/europe/article/spain-train-crash-madrid-latest-deaths-victims-807k...
8•ultral•35m ago•5 comments