Re: [Python-Dev] PEP 492: No new syntax is required

2015-04-27 Thread Mark Shannon
On 27/04/15 00:13, Guido van Rossum wrote: But new syntax is the whole point of the PEP. I want to be able to *syntactically* tell where the suspension points are in coroutines. Doesn't yield from already do that? Currently this means looking for yield [from]; PEP 492 just adds looking for

Re: [Python-Dev] PEP 492: No new syntax is required

2015-04-27 Thread Mark Shannon
On 26/04/15 23:24, Nick Coghlan wrote: On 27 Apr 2015 07:50, Mark Shannon m...@hotpy.org mailto:m...@hotpy.org wrote: On 26/04/15 21:40, Yury Selivanov wrote: But it's hard. Iterating through something asynchronously? Write a 'while True' loop. Instead of 1 line you now have 5 or

Re: [Python-Dev] PEP 492 vs. PEP 3152, new round

2015-04-27 Thread Greg Ewing
Yury Selivanov wrote: I've done some experiments with grammar, and it looks like we indeed can parse await quite differently from yield. Three different options: You don't seem to have tried what I suggested, which is to make 'await' a unary operator with the same precedence as '-', i.e.

Re: [Python-Dev] PEP 492 vs. PEP 3152, new round

2015-04-27 Thread Yury Selivanov
Hi Greg, I don't want this: await a() * b() to be parsed, it's not meaningful. Likely you'll see await await a() only once in your life, so I'm fine to use parens for it (moreover, I think it reads better with parens) Yury On 2015-04-27 8:52 AM, Greg Ewing wrote: Yury Selivanov wrote:

[Python-Dev] PEP 492: async/await in Python; v3

2015-04-27 Thread Yury Selivanov
Hi python-dev, Another round of updates. Reference implementation has been updated: https://github.com/1st1/cpython/tree/await (includes all things from the below summary of updates + tests). Summary: 1. PyTypeObject.tp_await slot. Replaces tp_reserved. This is to enable implementation of

Re: [Python-Dev] PEP 492: async/await in Python; v3

2015-04-27 Thread Stefan Behnel
Yury Selivanov schrieb am 28.04.2015 um 05:07: e) Should we add a coroutine ABC (for cython etc)? Sounds like the right thing to do, yes. IIUC, a Coroutine would be a new stand-alone ABC with send, throw and close methods. Should a Generator then inherit from both Iterator and Coroutine, or