[Python-ideas] Async API: some code to review
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Nov 1 23:37:59 CET 2012
Guido van Rossum wrote:
> If we weren't so reluctant to introduce new keywords in Python we
> might introduce await as an alias for yield from in the future.
Or 'cocall'. :-)
> I think tulip will end up requiring a decorator too -- but it will
> just "mark" the function rather than wrap it in another one, unless
> the function is not a generator (in which case it will probably have
> to wrap it in something that is a generator).
I don't see how that helps much, because the scheduler
doesn't see generators used in yield-from calls. There
is *no* way to catch the mistake of writing
foo()
when you should have written
yield from foo()
instead.
This is one way that codef/cocall (or some variant on it)
would help, by clearly diagnosing that mistake.
--
Greg
More information about the Python-ideas
mailing list