[Tutor] : breaking out of a function that takes too long

Kent Johnson kent37 at tds.net
Wed Sep 16 14:01:42 CEST 2009


On Wed, Sep 16, 2009 at 6:07 AM, C or L Smith <smiles at worksmail.net> wrote:
>>> Serdar wrote:
> ...
>>> So again, is there a way to place a time limit on the execution of a
>>> function, after which you can break out of it and then retry it or
>>> move along with the rest of your program?
>
> At http://tinyurl.com/rbre9n you can find a recipe that tells you how to decorate a function so it will return after a given amount of time. According to the comments, this will leave the process still running, but at least the whole program won't hang. I've used it successfully from time to time.

All that recipe really does is to tell you that the function has taken
too long. It doesn't stop it.

Kent


More information about the Tutor mailing list