News for hackers. Stuff that matters.
Re:Reasons for Python async/await by thristian on Wednesday May 20, 2015 @06:24PM (#9579757)
The nice thing about Python generator functions was that they didn't need a lot of syntax - if a function contains the "yield" keyword, it's a generator, otherwise it's not.

Given how closely tied generators are with async/await, why do we need "async def"? Isn't the presence of "await" or "async for" or "async with" enough to mark a function as asynchronous?

Re:Reasons for Python async/await by drothlis on Thursday May 21, 2015 @06:56AM (#9581884)
A major motivation for the new syntax is to support refactoring (currently moving "yield" into a sub-function makes the calling function no longer a generator).

See the PEP's "rationale and goals"[1] and this article[2] summarising the PEP.

[1] https://www.python.org/dev/peps/pep-0492/#rationale-and-goal... [2] https://lwn.net/Articles/643786/

Re:Reasons for Python async/await by ploxiln on Wednesday May 20, 2015 @08:14PM (#9580241)
There's already a decorator @asyncio.coroutine which "async def" replaces. It's used for error checking, but also for some functions which are coroutines but don't use "yield" - they just return a Future