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

2015-04-25 Thread Nick Coghlan
On 26 April 2015 at 06:18, Yury Selivanov wrote: > Option #3. Create a new terminal for await expression between > 'atom' and 'power'. > > Required grammar changes: > https://gist.github.com/1st1/cb0bd257b04adb87e167#file-option-3-patch > > Repo to play with (parser module is broken atm): > https:

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

2015-04-25 Thread Guido van Rossum
+1 for option 3. On Sat, Apr 25, 2015 at 1:18 PM, Yury Selivanov wrote: > Hi Guido, > > On 2015-04-24 1:03 PM, Guido van Rossum wrote: > >> *3. syntactic priority of `await`* >> >> Yury, could you tweak the syntax for `await` so that we can write the most >> common usages without parentheses? In

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-25 Thread Chris Angelico
On Sun, Apr 26, 2015 at 2:01 AM, Ronan Lamy wrote: >>> * PEP484 hints are too high-level. Replacing an 'int' object with a >>> single machine word would be useful, but an 'int' annotation gives no >>> guarantee that it's correct (because Python 3 ints can have arbitrary >>> size and because subcla

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

2015-04-25 Thread Yury Selivanov
Hi Arnaud, On 2015-04-25 4:47 PM, Arnaud Delobelle wrote: On Tue, 21 Apr 2015 at 18:27 Yury Selivanov wrote: Hi python-dev, I'm moving the discussion from python-ideas to here. The updated version of the PEP should be available shortly at https://www.python.org/dev/peps/pep-0492 and is also

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

2015-04-25 Thread Arnaud Delobelle
On Tue, 21 Apr 2015 at 18:27 Yury Selivanov wrote: > > Hi python-dev, > > I'm moving the discussion from python-ideas to here. > > The updated version of the PEP should be available shortly > at https://www.python.org/dev/peps/pep-0492 > and is also pasted in this email. > Hi Yury, Having read t

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

2015-04-25 Thread Yury Selivanov
Hi Guido, On 2015-04-24 1:03 PM, Guido van Rossum wrote: *3. syntactic priority of `await`* Yury, could you tweak the syntax for `await` so that we can write the most common usages without parentheses? In particular I'd like to be able to write ``` return await foo() with await foo() as bar: ..

Re: [Python-Dev] Type hints -- a mediocre programmer's reaction

2015-04-25 Thread Ronan Lamy
Le 25/04/15 04:07, Steven D'Aprano a écrit : On Sat, Apr 25, 2015 at 02:05:15AM +0100, Ronan Lamy wrote: * Hints have no run-time effect. The interpreter cannot assume that they are obeyed. I know what you mean, but just for the record, annotations are runtime inspectable, so people can (and

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

2015-04-25 Thread Greg Ewing
Victor Stinner wrote: It's now time to focus our good energy on discussing remaining questions on the PEP 492 to make it the best PEP ever! That's what I'm trying to do. I just think it would be even better if it could be made to address that issue somehow. I haven't thought of a way to do that

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

2015-04-25 Thread Andrew Svetlov
I used to think in the same way but found the result looks like Perl (or Haskell), not Python. On Sat, Apr 25, 2015 at 7:47 AM, Greg Ewing wrote: > Wild idea: > > Let "@" mean "async" when it's directly in front > of a keyword. > > Then we would have: > > @def f(): > ... > > @for x in it

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

2015-04-25 Thread Victor Stinner
2015-04-25 8:23 GMT+02:00 Greg Ewing : > But how is an awaitable supposed to raise StopIteration > if it's implemented by a generator or async def[*] function? > Those things use StopIteration to wrap return values. > > I like the idea of allowing StopIteration to be raised > in an async def functi

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

2015-04-25 Thread Victor Stinner
Hi Greg, 2015-04-25 7:02 GMT+02:00 Greg Ewing : >> I accept the compromise of creating a coroutine object without wait >> for it (obvious and common bug when learning asyncio). Hopefully, we >> keep the coroutine wrapper feature (ok, maybe I suggested this idea to >> Yury because I suffered so muc

Re: [Python-Dev] Surely "nullable" is a reasonable name?

2015-04-25 Thread Nick Coghlan
On 25 April 2015 at 17:58, Larry Hastings wrote: > > On 04/24/2015 09:45 PM, Nick Coghlan wrote: > > Ah, I misread Tal's suggestion. Using unary + is an even neater approach. > > > Not exactly. The way I figure it, the best way to achieve this with unary > plus is to ast.parse it (as we currently

Re: [Python-Dev] Surely "nullable" is a reasonable name?

2015-04-25 Thread Tal Einat
On Sat, Apr 25, 2015 at 10:58 AM, Larry Hastings wrote: > > On 04/24/2015 09:45 PM, Nick Coghlan wrote: > > Ah, I misread Tal's suggestion. Using unary + is an even neater approach. > > > Not exactly. The way I figure it, the best way to achieve this with unary > plus is to ast.parse it (as we c

Re: [Python-Dev] Surely "nullable" is a reasonable name?

2015-04-25 Thread Larry Hastings
On 04/24/2015 09:45 PM, Nick Coghlan wrote: Ah, I misread Tal's suggestion. Using unary + is an even neater approach. Not exactly. The way I figure it, the best way to achieve this with unary plus is to ast.parse it (as we currently do) and then modify the parse tree. That works but it's