A better way to timeout a class method?

Nick Craig-Wood nick at craig-wood.com
Mon Mar 9 18:30:04 EDT 2009


Marco Mariani <marco at sferacarta.com> wrote:
>  John O'Hagan wrote:
> 
> > Is there a concise Pythonic way to write a method with a timeout?
> 
>  No need for threading. Just define a signal handler and call signal.alarm().
> 
>  See the example at the end of the page:
> 
>  http://docs.python.org/library/signal.html

Won't work on windows and there is only one sigalarm timer, so you
can't nest them :-(

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list