> On Feb 11, 2020, at 14:02, Eric V. Smith wrote:
>
> One of the goals of the async/await syntax is to make it clear where control
> can yield, and therefor where you need to be concerned about mutating state.
> You don't have this explicitness with threads or with a hypothetical syntax
>
On 2/11/2020 2:33 AM, Ben Rudiak-Gould wrote:
On Mon, Feb 10, 2020 at 9:50 AM Andrew Barnert via Python-ideas
wrote:
It’s a well-known problem that async is “contagious”: [...]
But C# and every other language that’s borrowed the idea has the same problem,
and as far as I know, nobody’s
The idea on the OP can be fully implemented with ~10 lines of code in a
decorator -
which could be further factored out into a decorator-for-decorators:
```
import asyncio, inspect
def hybrid_decorator(func):
coro = inspect.iscoroutinefunction(func)
if coro:
async def
On 2020-02-11 4:33 a.m., Ben Rudiak-Gould wrote:
On Mon, Feb 10, 2020 at 9:50 AM Andrew Barnert via Python-ideas
wrote:
> It’s a well-known problem that async is “contagious”: [...]
>
> But C# and every other language that’s borrowed the idea has the same
problem, and as far as I know,
On Mon, Feb 10, 2020 at 9:50 AM Andrew Barnert via Python-ideas
wrote:
> It’s a well-known problem that async is “contagious”: [...]
>
> But C# and every other language that’s borrowed the idea has the same
> problem, and as far as I know, nobody’s thought of a good answer yet.
Threads don't
I wonder why async needed to be like it is.
await foo(...) could have turned into something like foo.__await__(...)
and had foo.__call__ just run the function anyway until actual yielding
is necessary (at which point, raise RuntimeError).
oh well, can't change that now I guess. :/
On
> On Feb 10, 2020, at 02:34, Bar Harel wrote:
>
> While I'm not this idea can totally work, I do think we need a method of
> closing the gap between asyc coroutines and normal functions.
>
> As of today, async applications need to create an entirely different
> codebase, sometimes just by
While I'm not sure this idea can totally work, I do think we need a method
of closing the gap between asyc coroutines and normal functions.
As of today, async applications need to create an entirely different
codebase, sometimes just by copy and paste, while changing function
definitions to async
On Feb 9, 2020, at 13:39, hason.a...@gmail.com wrote:
>
> As of today, in order to make a decorator compatible with both normal and
> async functions, you have to write something like this:
>
> def decor(func):
>if asyncio.iscoroutinefunction(func):
>async def wrapper(*args,