[Python-ideas] The async API of the future: yield-from
Steve Dower
Steve.Dower at microsoft.com
Wed Oct 17 15:54:22 CEST 2012
> But the scheduler we're talking about is all pure Python.
> If the interface is well known and universally used, and
> there's a good implementation of it in the standard
> library, why would anyone want another one?
Probably because they already have another one and can't get rid of it. Whether or not we are trying to include GUI development in this, I can guarantee that people will try and use it with a GUI message loop (to avoid blocking on IO, largely). In this case we'd almost certainly need a different implementation for Wx/Tcl/whatever.
"Universally used" is a nice idea, but it will take a long time to get there. A well known interface, especially one that doesn't require the loop itself (i.e. it doesn't have a blocking run() function), lets users write thin wrappers, like the one we did for Tcl: http://pastebin.com/FuZwc1Ur (CallableContext (the 'scheduler') base class is in http://pastebin.com/ndS53Cd8). There needs to be an way to change which one is used at runtime, but there only needs to be one per thread.
Cheers,
Steve
More information about the Python-ideas
mailing list