Killing threads (was Re: Cancel or timeout a long running regular expression)

Chris Angelico rosuav at
Sun Sep 18 01:19:46 CEST 2011

On Sun, Sep 18, 2011 at 8:27 AM, Chris Rebert <clp2 at> wrote:
> It's possible that the reason is analogous to why Java has deprecated
> its equivalent, Thread.stop():

Interesting. The main argument against having a way to raise an
arbitrary exception in a different thread is that it gets around
Java's requirement to declare all exceptions that a routine might
throw - a requirement that Python doesn't have. So does that mean it'd
be reasonable to have a way to trigger a "TerminateThread" exception
(like SystemExit but for one thread) remotely? The above article
recommends polling a variable, but that's the exact sort of thing that
exceptions are meant to save you from doing.


More information about the Python-list mailing list