Hi,
On 2015-04-23 3:30 AM, Wolfgang Langner 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.
You can't combine a keyword (await) with runtime decorator. Also
it's harder for tools to support @coroutine / @inlineCallbacks
than "async".
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.
I only lived without it because I used greenlets for async
for's & with's. There must be a native language concept to
do these things.
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.
The PEP isn't a result of some quick brainstorming. It's a
result of long experience using asyncio and working around
many painpoints of async programming.
Best is to give all this some more time and defer it to 3.6 and some alpha
releases to experiment with.
There is reference implementation. asyncio is fully ported,
every package for asyncio should work. You can experiment right now
and find a real issue why the PEP doesn't work.
Yury
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com