|
|
|
|
|
by BrandoElFollito
2978 days ago
|
|
Thanks, the trio tutorial is really enlightening! I was hoping (with Python, not trio in particular) that it would all end up with something like Promises which make coding really easy but I guess not. This is of course a matter of personal taste, but having call_a_asynch_function(with, some, parameters)
.then(with_the_result_when_it_comes => do_something)
some_other_codre_which_runs_synchronously
and_some_more
seems easier to my eye than the whole idea of calling await in async functions |
|
I wonder if you could do something nicer using the `with` syntax?
It's still going to be annoying when they nest, maybe an async with which makes its whole content act like promises with `then` calls? Though you also want to be able to return promises, I suppose you could allow `return async with`, and you also need to be able to catch them. Not sure if this makes any sense to look further at, but I don't think we're getting arrow functions and the JS syntax without those is pretty clunky.