[Twisted-Python] Flow, generators, coroutines etc.

Micky Latowicki ml.flex at gmail.com
Mon May 29 12:54:47 MDT 2006


Hmm, but it's precisely the same with python generators. If you yield, then
anything can happen by the time the function returns (same as with a
addCallback - anything can happen between adding the callback and the time
it's called). If you don't yield, but simply call a function, then only
those function's side effects can occur.

That's because a function called by a generator cannot yield on behalf of
that generator. I didn't appreciate that as a good thing until now, but now
I do.

On 29/05/06, zooko at zooko.com <zooko at zooko.com> wrote:
>
>
> Mark Miller (whose recently completed dissertation is available [1]),
> recently
> summarized in one sentence why event-based concurrency is safer than
> cooperative multithreading.  He said (quoting from memory): "The
> difference is
> that in an event-based system, when you invoke a function and the function
> returns, then you know that the only side-effects that could have happened
> are
> side-effects that *that* function was authorized to cause."
>
> Regards,
>
> Zooko
>
> [1] http://erights.org/talks/thesis/index.html
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20060529/4ac3a954/attachment.html>


More information about the Twisted-Python mailing list