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

2015-04-30 Thread Paul Sokolovsky
Hello, On Tue, 28 Apr 2015 20:59:18 +0100 Mark Shannon wrote: > > > On 28/04/15 20:24, Paul Sokolovsky wrote: > > Hello, > > > [snip] > > > Based on all this passage, my guess is that you miss difference > > between C and Python functions. > This is rather patronising, almost to the point of

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

2015-04-30 Thread Paul Sokolovsky
Hello, On Mon, 27 Apr 2015 08:48:49 +0100 Mark Shannon wrote: > > > 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?

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

2015-04-28 Thread Guido van Rossum
On Tue, Apr 28, 2015 at 11:51 AM, Stefan Behnel wrote: > Mark Shannon schrieb am 27.04.2015 um 09:48: > > On 27/04/15 00:13, Guido van Rossum wrote: > >> Currently this means looking for yield [from]; PEP 492 just adds looking > >> for await and async [for|with]. Making await() a function defeats

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

2015-04-28 Thread Mark Shannon
On 28/04/15 20:24, Paul Sokolovsky wrote: Hello, [snip] Based on all this passage, my guess is that you miss difference between C and Python functions. This is rather patronising, almost to the point of being insulting. Please keep the debate civil. [snip] Cheers, Mark. _

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

2015-04-28 Thread Stefan Behnel
Mark Shannon schrieb am 27.04.2015 um 09:48: > On 27/04/15 00:13, Guido van Rossum wrote: >> Currently this means looking for yield [from]; PEP 492 just adds looking >> for await and async [for|with]. Making await() a function defeats the >> purpose because now aliasing can hide its presence, and w

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

2015-04-28 Thread Glenn Linderman
On 4/26/2015 4:32 PM, Paul Sokolovsky wrote: Then, is the only logic for proposing __aenter__ is to reinsure against a situation that someone starts to write async context manager, forgets that they write async context manager, and make an __enter__ method there. Then your implementation will ann

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

2015-04-28 Thread Paul Sokolovsky
Hello, On Sun, 26 Apr 2015 20:39:55 -0400 Yury Selivanov wrote: [] > > As for 3rd point, I'd like to remind that CPython is only one Python > > implementation. And with my MicroPython hat on, I'd like to know if > > (some of) these new features are "bloat" or "worthy" for the space > > constrai

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

2015-04-28 Thread Paul Sokolovsky
Hello, On Sun, 26 Apr 2015 16:13:43 -0700 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. > Currently this means looking for yield [from]; PEP 492 just adds > looking for await and

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

2015-04-28 Thread Paul Sokolovsky
Hello, On Sun, 26 Apr 2015 19:45:30 -0400 Yury Selivanov wrote: [] > > Then, is the only logic for proposing __aenter__ is to reinsure > > against a situation that someone starts to write async context > > manager, forgets that they write async context manager, and make an > > __enter__ method

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

2015-04-28 Thread Paul Sokolovsky
Hello, On Sun, 26 Apr 2015 18:49:43 -0400 Yury Selivanov wrote: [] > >> >- it would look confusing > > Sorry, "async def __enter__" doesn't look more confusing than > > "__aenter__" (vs "__enter__"). > > I'll update the PEP. > > The argument shouldn't be that it's confusing, the argument > is

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

2015-04-28 Thread Paul Sokolovsky
Hello, On Sun, 26 Apr 2015 16:40:03 -0400 Yury Selivanov wrote: > Hi Mark, > > On 2015-04-26 4:21 PM, Mark Shannon wrote: > > Hi, > > > > I was looking at PEP 492 and it seems to me that no new syntax is > > required. > > Mark, all your points are explained in the PEP in a great detail: Inde

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" 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 6. Wa

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-26 Thread Yury Selivanov
Paul, On 2015-04-26 8:17 PM, Paul Sokolovsky wrote: Hello, On Sun, 26 Apr 2015 19:45:30 -0400 Yury Selivanov wrote: [] Then, is the only logic for proposing __aenter__ is to reinsure against a situation that someone starts to write async context manager, forgets that they write async contex

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

2015-04-26 Thread Yury Selivanov
Paul, On 2015-04-26 7:32 PM, Paul Sokolovsky wrote: Hello, On Sun, 26 Apr 2015 18:49:43 -0400 Yury Selivanov wrote: [] - it would look confusing Sorry, "async def __enter__" doesn't look more confusing than "__aenter__" (vs "__enter__"). I'll update the PEP. The argument shouldn't be tha

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

2015-04-26 Thread Guido van Rossum
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. Currently this means looking for yield [from]; PEP 492 just adds looking for await and async [for|with]. Making await() a function defeats the purpose because now a

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

2015-04-26 Thread Yury Selivanov
Paul, On 2015-04-26 6:25 PM, Paul Sokolovsky wrote: Ok, so here're 3 points this link gives, with my concerns/questions: >An alternative idea about new asynchronous iterators and context >managers was to reuse existing magic methods, by adding an async >keyword to their declarations: >[But:] >

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

2015-04-26 Thread Nick Coghlan
On 27 Apr 2015 07:50, "Mark Shannon" 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 6. Want to >> commit your database transaction? Instead of 'async with' you

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

2015-04-26 Thread Yury Selivanov
Brett, On 2015-04-26 6:09 PM, Brett Cannon wrote: How is it a burden for people porting Python 2 code? Because they won't get to name anything 'async' just like anyone supporting older Python 3 versions? Otherwise I don't see how it is of any consequence to people maintaining 2/3 code as it wi

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

2015-04-26 Thread Yury Selivanov
On 2015-04-26 5:48 PM, Mark Shannon wrote: On 26/04/15 21:40, Yury Selivanov wrote: Hi Mark, On 2015-04-26 4:21 PM, Mark Shannon wrote: Hi, I was looking at PEP 492 and it seems to me that no new syntax is required. Mark, all your points are explained in the PEP in a great detail: I did

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

2015-04-26 Thread Brett Cannon
On Sun, Apr 26, 2015, 17:49 Mark Shannon wrote: On 26/04/15 21:40, Yury Selivanov wrote: > Hi Mark, > > On 2015-04-26 4:21 PM, Mark Shannon wrote: >> Hi, >> >> I was looking at PEP 492 and it seems to me that no new syntax is >> required. > > Mark, all your points are explained in the PEP in a g

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

2015-04-26 Thread Mark Shannon
On 26/04/15 21:40, Yury Selivanov wrote: Hi Mark, On 2015-04-26 4:21 PM, Mark Shannon wrote: Hi, I was looking at PEP 492 and it seems to me that no new syntax is required. Mark, all your points are explained in the PEP in a great detail: I did read the PEP. I do think that clarifying the

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

2015-04-26 Thread Yury Selivanov
Hi Mark, On 2015-04-26 4:21 PM, Mark Shannon wrote: Hi, I was looking at PEP 492 and it seems to me that no new syntax is required. Mark, all your points are explained in the PEP in a great detail: Looking at the code, it does four things; all of which, or a functional equivalent, could

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

2015-04-26 Thread yoav glazner
How do you implement "async for"? On Sun, Apr 26, 2015 at 11:21 PM, Mark Shannon wrote: > Hi, > > I was looking at PEP 492 and it seems to me that no new syntax is required. > > Looking at the code, it does four things; all of which, or a functional > equivalent, could be done with no new syntax

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

2015-04-26 Thread Mark Shannon
Hi, I was looking at PEP 492 and it seems to me that no new syntax is required. Looking at the code, it does four things; all of which, or a functional equivalent, could be done with no new syntax. 1. Make a normal function into a generator or coroutine. This can be done with a decorator. 2. S