Python para impacientes

Python como usar o delay

January 04, 2020

Invokes the provided function after ms milliseconds.

Use time.sleep() to delay the execution of fn by ms / 1000 seconds.

from time import sleep

def delay(fn, ms, *args):
  sleep(ms / 1000)
  return fn(*args)
delay(
  lambda x: print(x),
  1000,
  'later'
) # prints 'later' after one second

Acesse a Referência original 1: Acesse a Referência original 2: