Ideas for yielding and exception raising

Calvin Spealman calvin at
Sat Jun 5 05:15:14 CEST 2004

I was wondering if it was possible, now or with a patch, to do either of the

1) Cause another thread's most recent function, or a given function in a
given thread, to yield its generator immediately, such that the generator
can be used to pick back up where it left off. That is, the function itself
wouldn't need an actually yield keyword. Could be used to allow a function
to be controlled in how much time it has per second or somewhat?

2) Cause an exception to be raised in all threads that have a reference to a
given object, as if the object itself is raising the exception. This would
allow functions to return Monitor Objects that would raise exceptions if
something bad happened. For example, maybe you want the function to run
continually until someone else requests access to some syncronized data,
and the Monitor would raise the exception at that time.

More information about the Python-list mailing list