Message298388
I understand rationale for rejection of this issue but i beg to reconsider.
Unlike in traditional coroutines (windows fibers / setjmp|longjmp with stack switching) we can not yield from any point of execution. There must be full async-await chain preserved. This basically divides code into two islands - async and non-async. And there seems to be no way to schedule async call from non-async code and get a response. While suggestion to make custom `async def contains()` call is a valid one we can not always do that. Consider the case when we have to do some networking calls in a function that is invoked by non-async library. Naturally it would be simple non-awaited call from which we can not call a coroutine and get a response. And since it is a library calling into our code we can not easily change it. It might even be completely unsuitable change for library in question.
I see two solutions to this problem (if i am missing something please point it out):
1. Reentrant loops as suggested in this issue.
2. Allow awaited calls from non-coroutines provided execution is invoked from a coroutine somewhere up the call stack.
First one is certainly easier to implement. |
|
Date |
User |
Action |
Args |
2017-07-15 08:21:47 | Rokas K. (rku) | set | recipients:
+ Rokas K. (rku), gvanrossum, vstinner, djarb, martin.panter, yselivanov |
2017-07-15 08:21:47 | Rokas K. (rku) | set | messageid: <1500106907.69.0.0486412919598.issue22239@psf.upfronthosting.co.za> |
2017-07-15 08:21:47 | Rokas K. (rku) | link | issue22239 messages |
2017-07-15 08:21:46 | Rokas K. (rku) | create | |
|