another try: "timout actions"

Diez B. Roggisch deetsNOSPAM at
Fri Oct 29 15:42:50 CEST 2004

> So, what other ways are there to code actions of the type described
> above? Which way would be the cleanest and most straightforward? (I
> don't want to use a program call, because this would decrease
> readability, portability and other good properties a lot.)

The only thing I can think of is to delegate the work to a therad, and wait
the specified period of time. If by then the result is computed, use it.
Otherwise continue - and ignore the thread. I admit that that is a ugly
solution - especially when the computation is time intensive. 

Maybe some gurus can elaborate on why the regexp-search isn't interrupted by
the signal - the only thing I can think of is that the signal is deferred
until the interpreter re-enters its bytecode-loop - but why the search is
so atomic I don't know.


Diez B. Roggisch

More information about the Python-list mailing list