logoalt Hacker News

theamktoday at 3:52 AM0 repliesview on HN

Great post, but the quiz is unfair - it assumes there is only one "true way", but a lot of frameworks give you options

For example, Trio has no global "spawn" method, by design. Judging by the results, authors assumed "with trio.open_nursery() as n: n.start_soon(write_to_log())", and so they got eager execution, dynamic extent, destructive propagation.

But opening a nursery just to write a single log line is absolutely crazy! The real program would use an appropriately scoped shared nursery: either per-request or global. Later option allows indefinite extent and "never" propagation.

Also, that "()" after write_to_log matters! If one follow trio's own examples, you'd write "n.start_soon(write_to_log)" - note no (). This will switch to lazy execution.

I am not familiar with non-python frameworks listed, but I would not be surprised if they allow for similarly wide range of behaviors.