It's python. ..that took too long to figure out
Waiting in Asyncio
11–20 of 31 posts
Re: Waiting in Asyncio
#12Trio is a much simpler design that's just as powerful as `asyncio`. It has exactly one way to wait for a task: await it. https://trio.readthedocs.io/ For a group of tasks, use a nursery. Edit: correction
I don’t see much more useful here than understanding the asyncio primitives and available synchronization abstractions, just a different API mostly overlapping the same need
To be clear, trio also has more than one way to wait for a task - any await is the same (e.g. `await trio.sleep(N)` (e.g. `await asyncio.sleep(N)`). I think maybe you’re getting at waiting for a group of tasks?
Re: Waiting in Asyncio
#13All these subtleties and gotchas signify, to me, a shit implementation and a fragmented interface. The exact opposite of the Zen of python.
Don't get me wrong, python is a lovely language when the universe aligns perfectly. But buggy libraries with fragmented interfaces are everywhere in the python community, and any zen that could have been had by pythons expressiveness gets obliterated by the various other warts and faults of the ecosystem. It's just a tool, not a form of enlightenment.
Re: Waiting in Asyncio
#14Trio is a much simpler design that's just as powerful as `asyncio`. It has exactly one way to wait for a task: await it. https://trio.readthedocs.io/ For a group of tasks, use a nursery. Edit: correction
To save others the search regarding a nursery: https://trio.readthedocs.io/en/stable/tutorial.html#okay-let... I don’t see much more useful here than understanding the asyncio primitives and available synchronization abstractions, just a different API mostly overlapping the same need To be clear, trio also has more than one way to wait for a task - any await is the same (e.g. `await trio.sleep(N)` (e.g. `await asynci…
For a theoretical take see
https://vorpus.org/blog/notes-on-structured-concurrency-or-g...
To be precise, to wait for a task its actually just await. Theres no ensure_future etc. Trio doesn't have the concept of futures or promises at all, and await f() is treated as a single piece of syntax, so in practice it doesn't have "awaitables" either.
Re: Waiting in Asyncio
#15All these subtleties and gotchas signify, to me, a shit implementation and a fragmented interface. The exact opposite of the Zen of python.
What would be the essence of that zen? A ridiculously slow interpreter? Littering your directories with .pyc files? The world's worst package and dependency management? Don't get me wrong, python is a lovely language when the universe aligns perfectly. But buggy libraries with fragmented interfaces are everywhere in the python community, and any zen that could have been had by pythons expressiveness gets obliterated…
Re: Waiting in Asyncio
#16Trio is a much simpler design that's just as powerful as `asyncio`. It has exactly one way to wait for a task: await it. https://trio.readthedocs.io/ For a group of tasks, use a nursery. Edit: correction
What do you get? For starters, Ctrl-C/KeyboardInterrupt just works. By restricting the design space, you end up with much more intuitive designs.
Obligatory Structured Concurrency essay link: https://vorpus.org/blog/notes-on-structured-concurrency-or-g...
I recommend giving it a read.
Re: Waiting in Asyncio
#17All these subtleties and gotchas signify, to me, a shit implementation and a fragmented interface. The exact opposite of the Zen of python.
Re: Waiting in Asyncio
#18- What's a good strategy to migrate a larger python codebase towards asyncio ? (Haven't found any)
Re: Waiting in Asyncio
#19It's python. ..that took too long to figure out
Re: Waiting in Asyncio
#20All these subtleties and gotchas signify, to me, a shit implementation and a fragmented interface. The exact opposite of the Zen of python.
What would be the essence of that zen? A ridiculously slow interpreter? Littering your directories with .pyc files? The world's worst package and dependency management? Don't get me wrong, python is a lovely language when the universe aligns perfectly. But buggy libraries with fragmented interfaces are everywhere in the python community, and any zen that could have been had by pythons expressiveness gets obliterated…
I think the confusion comes about because many people use Tao and zen interchangeably. The Tao is supposed to represent a total understanding of the underlying universal principals, which can be seen as a form of enlightenment.
However Zen is not that.
The zen of python would represent a way to meditate while coding in python. Though I will admit the actual document reads more like a Tao, and it was originally called “the way of Python” (Tao also translates as the way).