| Store | Cart

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

From: Guido van Rossum <gui...@python.org>
Tue, 28 Apr 2015 13:00:26 -0700
On Tue, Apr 28, 2015 at 11:51 AM, Stefan Behnel <stef...@behnel.de> 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 the> >> purpose because now aliasing can hide its presence, and we're back in> >> the land of gevent or stackless (where *anything* can potentially> >> suspend the current task). I don't want to live in that land.> >> > I don't think I was clear enough. I said that "await" *is* a function,> not> > that is should be disguised as one. Reading the code, "GetAwaitableIter"> > would be a better name for that element of the implementation. It is a> > straightforward non-blocking function.>> 1) it's not like people commonly alias "repr()" or "len()", so why would> they alias an "await()" builtin ? Unless, obviously, there's an actual> reason to do so, in which case having it as a functions comes in handy. :)> We had the same line of reasoning with "print()" back in the days of Py3k.>> 2) an "await()" builtin function that calls an "__await__()" special method> on its input object sounds very pythonic.>

This sounds confused. The await expression must be recognized by the parser
so it can generate different code for it (the code to suspend the stack). A
builtin function cannot generate different code -- to the compiler all
functions look the same. I know we could change that rule, but that' would
be a really a big deviation from Python's philosophy: Currently the code
generator never needs to know the type of any variables -- and a builtin
function 'await' would just be another variable to the code generator.

-- 
--Guido van Rossum (python.org/~guido)

_______________________________________________
Python-Dev mailing list
Pyth...@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/python-dev-ml%40activestate.com

Recent Messages in this Thread
Mark Shannon Apr 26, 2015 08:21 pm
yoav glazner Apr 26, 2015 08:26 pm
Yury Selivanov Apr 26, 2015 08:40 pm
Mark Shannon Apr 26, 2015 09:48 pm
Brett Cannon Apr 26, 2015 10:09 pm
Yury Selivanov Apr 26, 2015 10:16 pm
Yury Selivanov Apr 26, 2015 10:12 pm
Nick Coghlan Apr 26, 2015 10:24 pm
Mark Shannon Apr 27, 2015 08:09 am
Paul Sokolovsky Apr 26, 2015 10:25 pm
Yury Selivanov Apr 26, 2015 10:49 pm
Paul Sokolovsky Apr 26, 2015 11:32 pm
Yury Selivanov Apr 26, 2015 11:45 pm
Paul Sokolovsky Apr 27, 2015 12:17 am
Yury Selivanov Apr 27, 2015 12:39 am
Paul Sokolovsky Apr 27, 2015 10:48 pm
Glenn Linderman Apr 28, 2015 04:46 pm
Guido van Rossum Apr 26, 2015 11:13 pm
Paul Sokolovsky Apr 26, 2015 11:50 pm
Mark Shannon Apr 27, 2015 07:48 am
Stefan Behnel Apr 28, 2015 06:51 pm
Guido van Rossum Apr 28, 2015 08:00 pm
Paul Sokolovsky Apr 28, 2015 07:24 pm
Mark Shannon Apr 28, 2015 07:59 pm
Paul Sokolovsky Apr 28, 2015 09:14 pm
Messages in this thread