[Python-3000] Futures in Python 3000 (was Re: mechanism for handling asynchronous concurrency)

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Apr 19 08:35:34 CEST 2006


Andy Sy wrote:

> I don't know about you, but with the addition of send() to deal with
> the problem outlined in PEP 342, generators are starting to look more
> and more like a Rube Goldberg contraption.  Could anything be more
> Pythonic than Io's:
> 
> f := url @fetch  // f is a future that will eventually hold the
>                  // URL's contents, but you don't block on the fetch.

There's a lot more to this than syntax. The oddities
surrounding Python generators are mostly due to their
"one-level-deep" nature, i.e. they're not full coroutines.
And there are deep implementation reasons for that.

If syntax is all you're concerned about, you could translate
that into Python as something like

   f = url(future(fetch))

Now, how is that future() function going to be implemented,
again? :-)

--
Greg


More information about the Python-3000 mailing list