Logo

Programming-Idioms

History of Idiom 185 > diff from v18 to v19

Edit summary for version 19 by programming-idioms.org:
[Python] No need to define f inside the snippet

Version 18

2019-09-27, 07:51:07

Version 19

2019-09-27, 07:54:09

Idiom #185 Execute function in 30 seconds

Schedule the execution of f(42) in 30 seconds.

Idiom #185 Execute function in 30 seconds

Schedule the execution of f(42) in 30 seconds.

Extra Keywords
future
Extra Keywords
future
Imports
import threading
Imports
import threading
Code
  
def f(x): 
    return x
  
timer = threading.Timer(30.0, f, args=(42,) ) 
timer.start() 
Code
timer = threading.Timer(30.0, f, args=(42,) ) 
timer.start()