[Python-ideas] The async API of the future: yield-from
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Oct 16 09:45:35 CEST 2012
Calvin Spealman wrote:
> If we allow spawn(task())
> then we're not getting nice tracebacks anyway, so I think we should
> allow
>
> future1 = yield task1() # spawn task
> future2 = yield task2() # spawn other task
I don't think it's necessary to allow 'yield task' as a
method of spawning in order to get nice tracebacks for
spawned tasks.
In the Task-object-based system I'm thinking about, if
an exception reaches the top level of a Task, it gets
stored in the Task object until another task wait()s
for it, and then it continues to propagate.
This makes sense, because the wait() establishes a
task-subtask relationship, so the traceback should
proceed from the subtask to the waiting task.
> Both are primitives we
> need to support as first-class operation. That is, without some wrapper
> like spawn().
In my system, spawn() isn't a wrapper -- it *is* the
primitive way to create an independent task. And I
think it's the only one we need.
--
Greg
More information about the Python-ideas
mailing list