[Python-ideas] async/await in Python

Andrew Svetlov andrew.svetlov at gmail.com
Sun Apr 19 20:57:59 CEST 2015


On Sun, Apr 19, 2015 at 2:36 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Fri, 17 Apr 2015 20:19:42 +0000 (UTC)
> Victor Stinner <victor.stinner at gmail.com>
> wrote:
>> They are almost
>> required to make asyncio usage easier. "async for" would help database ORMs
>> or the aiofiles project (run file I/O in threads). "async with" helps also ORMs.
>
> I don't understand how it would help ORMs in any way. ORMs run database
> requests transparently when the user requests an attribute, which is
> completely at odds with the approach of explicitly marking (either
> through "yield from" or "await") all potentially yielding operations.
>

The PEP doesn't help ORMs from my perspective.
But `async with` and `async for` are very useful for transactions
(COMMIT or ROLLBACK on code block finish) and for iterations over
cursor (server-side cursors are require for getting new data bulk on
iteration).
The same is for non-RDBMs also: Redis may produce data piece-by-piece
on SCAN command for example.


> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/



-- 
Thanks,
Andrew Svetlov


More information about the Python-ideas mailing list