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@zooko.com <zooko@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@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python