On 2016-08-24 3:01 PM, Sven R. Kunze wrote:
On 24.08.2016 18:35, Guido van Rossum wrote:
On Wed, Aug 24, 2016 at 8:17 AM, Yury Selivanov
<yselivanov...@gmail.com <mailto:yselivanov...@gmail.com>> wrote:
On 2016-08-23 10:38 PM, Rajiv Kumar wrote:
I was playing with your implementation to gain a better
understanding of the operation of asend() and friends. Since
I was explicitly trying to "manually" advance the generators,
I wasn't using asyncio or other event loop. This meant that
the first thing I ran into with my toy code was the
RuntimeError ("cannot iterate async generator without
finalizer set").
As you have argued elsewhere, in practice the finalizer is
likely to be set by the event loop. Since the authors of
event loops are likely to know that they should set the
finalizer, would it perhaps be acceptable to merely issue a
warning instead of an error if the finalizer is not set? That
way there isn't an extra hoop to jump through for simple
examples.
In my case, I just called
sys.set_asyncgen_finalizer(lambda g: 1)
to get around the error and continue playing :) (I realize
that's a bad thing to do but it didn't matter for the toy cases)
Yeah, maybe warning would be sufficient. I just find it's highly
unlikely that a lot of people would use async generators without
a loop/coroutine runner, as it's a very tedious process.
Heh, I had the same reaction as Rajiv. I think the tediousness is
actually a good argument that there's no reason to forbid this. I
don't even think a warning is needed. People who don't use a
coroutine runner are probably just playing around (maybe even in the
REPL) and they shouldn't get advice unasked.
I also was irritated as Yury said there were absolutely no changes
after python-ideas. He said he might consider a clearer warning for
those examples at the beginning of the PEP to make them work for the
reader.
Sorry for making you irritated. Please feel free to remind me about any
concrete changes to the PEP that I promised to add on python-ideas.
I'll go and re-read that thread right now anyways.
Yury
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com