[Python-Dev] async/await in Python; v2

Antoine Pitrou solipsis at pitrou.net
Thu Apr 23 10:54:43 CEST 2015


Hi,

I agree with most of Wolfgang's points below. As a data point, I
haven't used asyncio for anything real (despite having approved the
PEP!), but I have some extensive prior experience with Twisted and
Tornado :-)

Regards

Antoine.


On Thu, 23 Apr 2015 09:30:30 +0200
Wolfgang Langner <tds333+pydev at gmail.com> wrote:
> Hi,
> 
> most of the time I am a silent reader but in this discussion I must step in.
> I use twisted and async stuff a lot over years followed development of
> asyncio closely.
> 
> First it is good to do differentiate async coroutines from generators. So
> everyone can see it and have this in mind
> and don't mix up booth. It is also easier to explain for new users.
> Sometimes generators blows their mind and it takes
> a while to get used to them. Async stuff is even harder.
> 
> 1. I am fine with using something special instead of "yield" or "yield
> from" for this. C# "await" is ok.
> 
> Everything else suggested complicates the language and makes it harder to
> read.
> 
> 2.
> async def f(): is harder to read and something special also it breaks the
> symmetry in front (def indent).
> Also every existing tooling must be changed to support it. Same for def
> async, def f() async:
> I thing a decorator is enough here
> @coroutine
> def f():
> is the best solution to mark something as a coroutine.
> 
> 
> 3.
> async with and async for
> Bead idea, we clutter the language even more and it is one more thing every
> newbie could do wrong.
> for x in y:
>   result = await f()
> is enough, every 'async' framework lived without it over years.
> Same for with statement.
> 
> The main use case suggested was for database stuff and this is also where
> most are best with
> defer something to a thread and keep it none async.
> 
> 
> All together it is very late in the development cycle for 3.5 to
> incorporate such a big change.
> Best is to give all this some more time and defer it to 3.6 and some alpha
> releases to experiment with.
> 
> Regards,
> 
> Wolfgang




More information about the Python-Dev mailing list