[Python-ideas] PEP 530: Asynchronous Comprehensions

Koos Zevenhoven k7hoven at gmail.com
Wed Sep 7 07:35:17 EDT 2016


On Wed, Sep 7, 2016 at 2:11 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 7 September 2016 at 04:54, Sven R. Kunze <srkunze at mail.de> wrote:
>> On 06.09.2016 20:37, Nick Coghlan wrote:
>>> As Anthony already noted, the "async" keyword switches to the
>>> asynchronous version of the iterator protocol - you use this when your
>>> *iterator* needs to interact with the event loop, just as you do when
>>> deciding whether or not to mark a for loop as asynchronous.
>>
>> Of course "async" switches to async mode. But that was not the question. I
>> asked WHY that's necessary not what it does. I already noted that Python can
>> detect when to make the switch without a marker. And you fail to explain
>> where the issue with this point of view is.
>
> The Python *runtime* can tell whether the result of an expression is a
> normal iterator or an asynchronous iterator, but the Python *compiler*
> can't.

Yes, so to remove "async" from the syntax, this would be handled at
runtime. But there's no way this PEP is going to do that, so I agree
there's no point in discussing this here.

-- Koos


-- 
+ Koos Zevenhoven + http://twitter.com/k7hoven +


More information about the Python-ideas mailing list