On Wed, Nov 30, 2016 at 7:07 AM, Marko Rauhamaa <ma...@pacujo.net> wrote:
> Ok, so how about:
>
>    aall(aiterable)
>    aany(aiterable)
>    class abytearray(aiterable[, encoding[, errors]])
>    class adict(aiterable, **kwarg)
>    class afilter(coro, aiterable)
>    class afrozenset(aiterable)
>    aiter(object[, sentinel])
>    class alist(aiterable)
>    amap(coro, aiterable, ...)
>    amax(aiterable, *[, key, default])
>    amin(aiterable, *[, key, default])
>    anext(aiterator[, default])
>    class aset(aiterable)
>    asorted(aiterable[, key][, reverse])
>    asum(aiterable[, start])
>    atuple(aiterable)
>    azip(*aiterables)
>
> to name a few...
>
> How about awaitable comprehensions?

Any of these that depend on pumping the entire iterable can simply
synchronify [1] the iterable:

list(x async for x in aiterable)

Interestingly, I can't do that in a list comp:

>>> [x async for x in aiterable]
  File "<stdin>", line 1
    [x async for x in aiterable]
           ^
SyntaxError: invalid syntax

Not sure why. Anyhow. That removes the need for alist, atuple, amax,
etc. All you would need are the ones that process an iterable and
yield values individually, like azip and amap. Those can be provided
as recipes, third-party modules, or stdlib modules, until they prove
their worth as potential builtins.

ChrisA

[1] is that even a word?
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to