On 2012-10-25, at 3:25 PM, Guido van Rossum
On Thu, Oct 25, 2012 at 11:39 AM, Yury Selivanov
wrote:
[...]
One idea: the scope of the problem is enormously big. It may take months/years to synchronize all ideas and thoughts by just communicating ideas over mail list without a concrete thing and subject to discuss. How about you/we create a repository with a draft implementation of scheduler/io loop/coroutines engine and we simply start tweaking an discussing that particular design? That way people will see where to start the discussion, what's done, and some will even participate? The goal is not to write a production-quality software, but rather to have a common place to discuss/try things/benchmark etc. I'm not sure, but maybe places like bitbucket, where you can have a wiki, issues, and the actual code is a better place, than a mail-list.
I am currently working on code. Steve Dower has also said he's going to write some code. I'm just not quite ready to show my code (I need to do a few more iterations on each component). As long as I can use Mercurial I'm happy; bitbucket or Google Code Hosting both work fine for me.
OK. Let's wait until we have a somewhat stable platform to work with. [...]
Is it (roughly) how you want it all to look like? I.e. using 'yield' to send a future/task to the scheduler, and 'yield from' to delegate?
I think that's the style that Steve Dower prefers. Greg Ewing would rather see all public APIs use yield from, and reserve plain yield exclusively as an implementation detail of the scheduler. In my own experimental code I am using Greg's style and it is working out great. My main reason for taking a hard stance on this is that it would otherwise be too confusing for users -- should they use yield, yield from, or a plain call? I'd like to tell them "if it blocks, use yield from".
BTW, if you haven't read Greg's introduction to this style, here it is -- worth reading! http://www.cosc.canterbury.ac.nz/greg.ewing/python/tasks/SimpleScheduler.htm...
If I guessed correctly, and that's how you envision it, I have a question: What if you decide to refactor 'Socket.sendall' to be a coroutine? In that case you'd want users to call it 'yield from Socket.sendall', and not 'yield Socket.sendall'.
That's why using yield from all the way is better!
Yes, that now makes sense! I'll definitely take a look at Greg's article. Thanks, Yury