Rustom Mody <rustompm...@gmail.com>:

> Bah -- What a bloody mess!
> And thanks for pointing this out, Ian.
> Keep wondering whether my brain is atrophying, or its rocket science or...

I'm afraid the asyncio idea will not fly.

Adding the keywords "async" and "await" did make things much better, but
the programming model seems very cumbersome.

Say you have an async that calls a nonblocking function as follows:


     async def t():
         ...
         f()
         ...

     def f():
         ...
         g()
         ...

     def g():
         ...
         h()
         ...

     def h():
         ...

Then, you need to add a blocking call to h(). You then have a cascading
effect of having to sprinkle asyncs and awaits everywhere:

     async def t():
         ...
         await f()
         ...

     async def f():
         ...
         await g()
         ...

     async def g():
         ...
         await h()
         ...

     async def h():
         ...
         await ...
         ...

A nasty case of nonlocality. Makes you wonder if you ought to declare
*all* functions *always* as asyncs just in case they turn out that way.

Note that neither the multithreading model (which I dislike) nor the
callback hell (which I like) suffer from this problem.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to