Is there a better way to implement this:

Paul Boddie paul at boddie.org.uk
Mon Jan 22 13:22:20 EST 2007


Michael Yanowitz wrote:
>
>    I guess I am looking for something portable (both
> Windows and Linux) where I can abort a function after
> a certain time limit expires.

Doing a search for "timeout function Python" on Google reveals a number
of approaches.

Using signals:

  * http://nick.vargish.org/clues/python-tricks.html
  * http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/307871

Using threads:

  * http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473878

Using processes:

  * http://lfw.org/python/delegate.html

Paul




More information about the Python-list mailing list