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.

CVE-2026-111943: Compromised Intermediate Certificate Authority

https://nvd.nist.gov/vuln/detail/cve-2026-111943
69•keks24•1h ago•12 comments

WorldTUI: I trained a 360M model to pretend to be a terminal

https://simedw.com/2026/10/21/world-model-terminal/
206•alphax314•7h ago•63 comments

The recently proposed o(n log n) integer multiplication algorithm [pdf]

https://web.maths.unsw.edu.au/~davidharvey/research/subnlogn.pdf
206•craigcitro•7h ago•136 comments

Security Disclosure

https://blog.railway.com/p/security-disclosure-wednesday-october-21st
462•passenger•11h ago•270 comments

Achieving AI-style reasoning without an LLM

https://fleetingswallow.com/minotaur-ai-deep-dive-achieving-reasoning-without-a-language-model/
9•edwardchalk•1h ago•1 comments

Faster than earcut: triangulating 3.7M map polygons in 489 ms

https://globus.software/blog/2026/10/16/cutting-map-polygons/
3•molind•23m ago•0 comments

Claude Duet

https://claude.com/product/claude-duet
377•kuberwastaken•14h ago•345 comments

No more icons in every menu by default

https://blog.jim-nielsen.com/2026/icons-in-every-menu/
314•riffraff•2d ago•194 comments

Using LLM for confidence scoring is a bad idea

https://rumple.github.io/blog/2026/10/20/asking-llm-for-confidence.html
93•jimauthors•1d ago•48 comments

OpenAI CLI

https://github.com/openai/openai-cli
118•armcat•4h ago•68 comments

Compromised LiteLLM 1.107.0 on PyPI Installs a Credential Stealer and Backdoor

https://safedep.io/litellm-pypi-compromise-credential-stealer-backdoor/
514•abhisek•19h ago•171 comments

Rust Style Guide

https://google.github.io/styleguide/rustguide.html
305•kaycebasques•14h ago•184 comments

GitLab critical patch release

https://docs.gitlab.com/releases/patches/patch-release-gitlab-19-5-1-released/
351•artooro•14h ago•82 comments

The Robot I Didn't Expect to Build

https://spectrum.ieee.org/agility-robotics-digit-5-redesign
7•bojackh•2d ago•1 comments

What Is the Karakoram Anomaly?

https://nsidc.org/learn/ask-scientist/karakoram-anomaly-it-real
32•thunderbong•2d ago•7 comments

PingCap TiDB Leaks

https://fulcrumsec.vg/pingcap/
349•swyx•1d ago•53 comments

Meta ordered to pay $25B penalty in New Mexico Cambridge Analytica case

https://www.cnbc.com/2026/10/21/meta-new-mexico-cambridge-analytica-penalty.html
555•cbg0•16h ago•326 comments

Tiny possum and glider thought extinct for 6000 years found in remote West Papua

https://www.bbc.com/news/articles/cp814l80pw2o
219•bryanrasmussen•2d ago•48 comments

Beyond the &

https://lwn.net/Articles/1096028/
64•PaulHoule•1d ago•3 comments

mitmproxy adds --emudhra option

https://github.com/mitmproxy/mitmproxy/commit/169234499088fc2c414644a67efaed3d64ae2e3b
477•ahlCVA•10h ago•114 comments

Code is clay now

https://www.albertodenia.com/writing/code-is-clay-now
169•albertodenia•2d ago•112 comments

OpenAI models are coming to Google Cloud

https://openai.com/index/openai-models-google-cloud/
291•armcat•21h ago•121 comments

DuckDB 2.0.0 LTS “Cinnamon Teal”

https://duckdb.org/2026/10/21/announcing-duckdb-200
416•nnx•19h ago•56 comments

ThinkPad I9990303 Error Catch-22

http://www.os2museum.com/wp/thinkpad-i9990303-error-catch-22/
25•userbinator•2d ago•3 comments

Today's PHP security release, and how we're strengthening security

https://thephp.foundation/blog/2026/10/21/todays-php-security-release-and-how-were-strengthening-...
737•ejohnso49•18h ago•362 comments

Show HN: Omnara – Open-source alternative to Claude Managed Agents

https://github.com/omnara-ai/omnara
79•kmansm27•17h ago•25 comments

Chain of Thought for Humans

https://www.boristhebrave.com/2026/10/18/chain-of-thought-for-humans/
93•ibobev•2d ago•47 comments

There isn't an easy exploit for this PHP vulnerability

https://eliastaylor.com/noexploit/
521•zkldi•10h ago•314 comments

PHP 8.2.35

https://github.com/php/php-src/releases/tag/php-8.2.35
1034•tuyuri•20h ago•547 comments

Oregon lawmakers approve money to buy an iconic waterfall listed on Redfin

https://apnews.com/article/oregon-waterfall-for-sale-lawmakers-996de63462d49ec3ad9bee1629fb9488
188•surprisetalk•18h ago•96 comments