frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Async Python Is Secretly Deterministic

https://www.dbos.dev/blog/async-python-is-secretly-deterministic
23•KraftyOne•1h ago

Comments

lexicality•1h ago
> This makes it possible to write simple code that’s both concurrent and safe.

Yeah, great, my hello world program is deterministic.

What happens when you introduce I/O? Is every network call deterministic? Can you depend on reading a file taking the same amount of time and being woken up by the scheduler in the same order every time?

KraftyOne•59m ago
That's the cool thing about this behavior--it doesn't matter how complex your program is, your async functions start in the same order they're called (though after that, they may interleave and finish in any order).
lexicality•45m ago
Only for tasks that are created in synchronous code. If you start two tasks that each make a web request and then start a new task with the result of that request you will immediately lose ordering.
KraftyOne•13m ago
Yes, this only applies for tasks created from the same (sync or async) function. If tasks are creating other tasks, anything is possible.
PufPufPuf•48m ago
This is about durable execution -- being able to resume execution "from the middle", which is often done by executing from the beginning but skipping external calls. Second time around, the I/O is exactly replayed from stored values, and the "deterministic" part only refers to the async scheduler which behaves the same as long as the results are the same.

Coincidentally I have been experimenting with something very similar in JavaScript in the past and there the scheduler also has the same property.

arn3n•1h ago
While not production ready, I’ve been happily surprised at this functionality when building with it. I love my interpreters to be deterministic, or when random to be explicitly seeded. It makes debugging much easier when I can rerun the same program multiple times and expect identical results.
frizlab•1h ago
Interestingly I think things that should not be deterministic should actually forced not to be.

Swift for instance will explicitly make iterating on a dictionary not deterministic (by randomizing the iteration), in order to catch weird bugs early if a client relies (knowingly or not) on the specific order the elements of the dictionary are ordered.

lilyball•34m ago
This claim sounds vaguely familiar to me (though the documentation on Dictionary does not state any reason for why the iteration order is unpredictable), though the more common reason for languages to have unstable hash table iteration orders is as a consequence of protection against hash flooding, malicious input causing all keys to hash to the same bucket (because iteration order is dependent on bucket order).
saidinesh5•7m ago
One more reason for randomizing hash table iteration was to prevent Denial of service attacks:

https://lukasmartinelli.ch/web/2014/11/17/php-dos-attack-rev...

12_throw_away•51m ago
No, determinstic scheduling is not a property of async python.

Yes, the stdlib asyncio event loop does have deterministic scheduling, but that's an implementation detail and I would not rely on it for anything critical. Other event loops - for instance trio [1] - explicitly randomize startup order so that you won't accidentally write code that relies on it.

[1] https://github.com/python-trio/trio/issues/32

KraftyOne•19m ago
It's been a stable (and documented) behavior of the Python standard library for almost a decade now. It's possible it may change--nothing is ever set in stone--but that would be a large change in Python that would come with plenty of warning and time for adjustment.
StableAlkyne•8m ago
> but that's an implementation detail

That sounds familiar...

https://stackoverflow.com/questions/39980323/are-dictionarie...

whinvik•50m ago
Is this guaranteed by the async specification? Or is this just current behavior which could be changed in a future update. Feels like a brittle dependency if its not part of the spec.
KraftyOne•15m ago
It's documented behavior for the low-level API (e.g. asyncio.call_soon https://docs.python.org/3/library/asyncio-eventloop.html#asy...). More broadly, this has been a stable behavior of the Python standard library for almost a decade now. If it does change, that would be a huge behavioral change that would come with plenty of warning and time for adjustment.
jpollock•11m ago
That's deterministic dispatch, as soon as it forks or communicates, it is non deterministic again?

Don't you need something like a network clock to get deterministic replay?

It can't use immediate return on replay, or else the order will change.

This makes me twitchy. The dependencies should be better modelled, and idempotency used instead of logging and caching.

Oracle Files H-1B Visa Petitions Amid Mass Layoffs

https://nationaltoday.com/us/tx/austin/news/2026/04/03/oracle-files-thousands-of-h-1b-visa-petiti...
2•kklisura•1m ago•0 comments

Artemis II Multimedia: Crew Photos, Videos and Mission Highlights

https://www.nasa.gov/artemis-ii-multimedia/
1•mpweiher•2m ago•0 comments

Show HN: Screenshot web components with one click

https://chromewebstore.google.com/detail/webcap/hiofbhgfmcaiohmbdlajagfbhkikpcim
1•ayakut•3m ago•0 comments

DropSmith – Generate structured NPC dialogue for games via MCP

https://www.npmjs.com/package/dropsmith-mcp
1•dropsmith•4m ago•0 comments

Show HN: Language Operator – Kubernetes operator for managing agents at scale

https://github.com/language-operator/language-operator
2•fretlessjazz•6m ago•0 comments

Carnus: Exploring the Privacy Threats of Browser Extension Fingerprinting [pdf]

https://www.cs.uic.edu/~polakis/papers/karami-ndss21.pdf
2•1vuio0pswjnm7•6m ago•0 comments

Run multi-service projects locally with AI-friendly unified dashboard

https://github.com/ykosyakov/simple-local
2•ykosyakov•8m ago•0 comments

Automatic Textbook Formalization

https://github.com/facebookresearch/repoprover
2•tzury•8m ago•1 comments

A simple and fast terminal-based note-taking app, build with rust

https://github.com/bakudas/ztlgr
1•bakudas•8m ago•0 comments

Show HN: LangChain Is Dead, Long Live TmuxIsFree

https://github.com/cochranblock/tmuxisfree
1•cochranblock•8m ago•0 comments

OpenAI's Fidji Simo Is Taking Medical Leave Amid an Executive Shake-Up

https://www.wired.com/story/openais-fidji-simo-is-taking-a-leave-of-absence/
1•philip1209•10m ago•0 comments

LLM coding is the wrong layer of abstraction

https://bbuyukliev.blogspot.com/2026/04/llm-coding-is-wrong-layer-of-abstraction.html
1•bluetomcat•10m ago•1 comments

Pupils in England losing their thinking skills because of AI, survey suggests

https://www.theguardian.com/technology/2026/apr/02/pupils-england-losing-thinking-skills-because-...
4•gnabgib•10m ago•0 comments

Tracing a Coordinated BLE Device Deployment Across Los Angeles

https://github.com/AndriiKempa/BLEIOT/discussions/34
1•KempaAndrii•10m ago•0 comments

Show HN: Autheona – The API That Stops Fake Sign-Ups

https://autheona.com/
1•lasgawe•10m ago•0 comments

Bike Safety Rules in Cities

https://decasia.org/tech/2026/04/bike-safety.html
1•decasia•13m ago•0 comments

Gajim 2.4.5 has been released – GTK XMPP/Jabber Chat Client – Communication

https://gajim.org/posts/2026-03-30-gajim-2.4.5-released/
1•neustradamus•14m ago•0 comments

Can a machine "understand" like a human? The Chinese room argument

https://en.wikipedia.org/wiki/Chinese_room
2•Muhammad523•14m ago•1 comments

A new Postcrossing stamp from the USA

https://www.postcrossing.com/blog/2026/03/31/a-new-postcrossing-stamp-from-the-usa
1•Tomte•18m ago•0 comments

New digital hall passes track bathroom breaks, gather data in NYC schools

https://gothamist.com/news/new-digital-hall-passes-track-bathroom-breaks-gather-data-in-nyc-schools
2•gnabgib•23m ago•1 comments

Show HN: Mrg – Clean miscellaneous files created by macOS

https://github.com/ilotoki0804/mrg
1•ilotoki0804•23m ago•0 comments

Review into mental health conditions, ADHD and autism: interim report

https://www.gov.uk/government/publications/independent-review-into-mental-health-conditions-adhd-...
1•irickt•24m ago•1 comments

New microwave frying technique could make French fries much healthier

https://www.sciencedaily.com/releases/2026/04/260402042803.htm
3•AdmiralAsshat•24m ago•0 comments

Show HN: Run Claude Code autonomously inside your Docker Compose stack (OSS)

https://github.com/sayil/dangerously
3•sayil•24m ago•0 comments

DiscoDB – Relational database stored 100% in a Discord guild

https://github.com/lasect/discodb
2•jedeusus•26m ago•0 comments

Staff SWE and Staff DS Roles at Pomelo Care

https://www.pomelocare.com/
1•liaskevofilax•27m ago•0 comments

We Built a Language for AI Pipelines

https://2389.ai/posts/why-we-built-a-language-for-ai-pipelines/
2•harper•28m ago•0 comments

Show HN: Large scale hallucinated citation problem in published literature

https://www.nature.com/articles/d41586-026-00969-z
1•cyclecycle•28m ago•0 comments

Tcpdump Is the Network Debugging Tool You Should Have Learned Years Ago

https://keninkujovic.com/blog/tcpdump
3•speckx•28m ago•0 comments

Web 0.1 (2006)

https://thedailywtf.com/articles/web_0_0x2e_1
1•LorenDB•31m ago•0 comments