fork download
  1. from time import sleep
  2. from threading import Timer
  3.  
  4. def setTimeout(f):
  5. f()
  6. def test_function():
  7. print 'test'
  8.  
  9. Timer(2.5,setTimeout,args = [test_function]).start()
  10. for i in range(5):
  11. print i
  12. sleep(1)
Success #stdin #stdout 0.02s 16584KB
stdin
Standard input is empty
stdout
0
1
2
test
3
4