with timeout(...):

Nick Craig-Wood nick at craig-wood.com
Mon Mar 26 06:30:04 EDT 2007


Did anyone write a contextmanager implementing a timeout for
python2.5?

I'd love to be able to write something like

    with timeout(5.0) as exceeded:
        some_long_running_stuff()
    if exceeded:
        print "Oops - took too long!"

And have it work reliably and in a cross platform way!

>From my experiments with timeouts I suspect it won't be possible to
implement it perfectly in python 2.5 - maybe we could add some extra
core infrastructure to Python 3k to make it possible?

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



More information about the Python-list mailing list