[Python-ideas] Async API: some code to review

Terry Reedy tjreedy at udel.edu
Thu Nov 1 18:50:56 CET 2012


On 11/1/2012 12:44 PM, Steve Dower wrote:

>>> C# and VB use
>>> their async/await keywords (good 8 min intro video on those:
>>> http://www.visualstudiolaunch.com/vs2012vle/Theater?sid=1778

Thanks for the link. It make much of this discussion more concrete for 
me. As a potential user, the easy async = @async, await = yield from 
transformation (additions) is what I would like for Python.

I do realize that the particular task was picked to be easy and that 
other things might be harder (on Windows), and that Python has the 
additional problem of working on multiple platforms. But I think 'make 
easy things easy and difficult things possible' applies here.

I have no problem with 'yield from' instead of 'await' = 'wait for'. 
Actually, the caller of the movie list fetcher did *not* wait for the 
entire list to be fetched, even asynchronously. Rather, it displayed 
items as they were available (yielded). So the app does less waiting, 
and 'yield as available' is what 'await' does in that example.

Actually, I do not see how just adding 4 keywords would necessarily have 
the effect it did. I imagine there is a bit more to the story than was 
shown, like the 'original' code being carefully written so that the 
change would have the effect it did. The video is, after all, an 
advertorial. Nonetheless, it was impressive.

-- 
Terry Jan Reedy




More information about the Python-ideas mailing list