[Python-ideas] yield from multiple iterables (was Re: The async API of the future: yield-from)

Jasper St. Pierre jstpierre at mecheye.net
Sat Oct 20 21:25:44 CEST 2012


I'm curious now... you keep mentioning Futures and Deferreds like
they're two separate entities. What distinction between the two do you
see?

On Sat, Oct 20, 2012 at 2:29 PM, Guido van Rossum <guido at python.org> wrote:
> Maybe it would help if I was more straightforward.
>
> I do not want to solve this problem by introducing yet another
> language mechanism. This rules out codef, greenlets, and Stackless.
>
> I want to solve it using what we have in Python 3.3. And I want to
> solve it for all platforms where Python 3.3 runs and for all Python
> 3.3 implementations (assuming Jython, IronPython and PyPy will
> eventually get there).
>
> Basically this leaves as options OS threads, callbacks (+ Deferred),
> or yield [from].
>
> Using OS threads the problem is solved without writing any code, but
> does not scale, so it does not really solve the problem.
>
> To scale we need either callbacks or yield [from], or both.
>
> I accept that some people prefer to use callbacks and Deferred. I want
> to respect this choice and I want to see integration with this style
> at the event loop level.
>
> But for myself, I know that I want to write *most* code without
> callbacks (or Deferreds), and I am quite comfortable to use yield or
> yield from instead. (I have written a lot of code using yield
> <future>, and I am now practicing yield from <generator> -- the
> transition is quite easy and I like what I see.)
>
> If you are not happy with what we can do in (portable) Python 3.3, we
> are not talking about solving the same problem.
>
> If you are happy using OS threads, we are also not talking about
> solving the same problem. (To be sure, there is a place for them in my
> solution -- but it is only needed for things we cannot run
> asynchronously, such as socket.getaddrinfo().)
>
> If you are not happy using callbacks/Deferred nor using yield[from],
> you're welcome to use greenlets or Stackless. But they will not be in
> the standard library.
>
> --
> --Guido van Rossum (python.org/~guido)
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas



-- 
  Jasper



More information about the Python-ideas mailing list