[Python-ideas] PEP 530: Asynchronous Comprehensions

Nick Coghlan ncoghlan at gmail.com
Wed Sep 7 15:06:15 EDT 2016


On 8 Sep 2016 02:48, "Guido van Rossum" <guido at python.org> wrote:
>
> On Wed, Sep 7, 2016 at 9:34 AM, Yury Selivanov <yselivanov.ml at gmail.com>
wrote:
> > Thank you for accepting the PEP!  Will focus on the implementation now.
>
> You're welcome! Good luck with the implementation.
>
> @Nick, regarding the suggestion to use
>
>   [<expr> for <var> in async <iterable>]
>
> instead of
>
>   [<expr> async for <var> in <iterable>]
>
> I think the lack of grammaticality is actually a feature -- we don't
> want people to confuse `async <iterable>` with `await <iterable>`.

Aye, that problem occurred to me after my last post and is definitely a
concern.

> Python has no other postfix syntax like this (unless you count f(),
> d[k] or x.a as postfix) so I don't think people are likely to mistake
> this for an 'async' postfix on <expr> rather than a prefix on 'for'.
> Hopefully they've seen an 'async for' statement before they encounter
> an async comprehension.

I also realised that the worst case outcome I can see for the PEP 492 based
syntax is some folks avoiding them in favour of the statement version
because they don't like how the expression version reads (ala lambda), and
as worst case scenarios go, that's not a particularly worrying one :)

Cheers,
Nick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160908/6fea2865/attachment.html>


More information about the Python-ideas mailing list