[Python-ideas] The async API of the future: yield-from
Greg Ewing
greg.ewing at canterbury.ac.nz
Sat Oct 20 04:44:51 CEST 2012
Guido van Rossum wrote:
> In your current style you write
> things like this:
>
> block(self.queue)
> yield
>
> I don't see how this decouples the call site of the primitive from the
> scheduler any more than if you were to write e.g. this:
>
> yield block(self.queue)
If I wrote a library intended for serious use, the end user
probably wouldn't write either of those. Instead he would
write something like
yield from block(self.queue)
and it would be an implementation detail of the library
where abouts the 'yield' happened and whether it needed
to send a value or not.
When I say I don't like scheduler instructions, all I really
mean is that they shouldn't be part of the public API.
A scheduler can use them internally if it wants, I don't
care.
--
Greg
More information about the Python-ideas
mailing list