Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eclecticmiraclecat/684729931c728aa957d5bf381862c251 to your computer and use it in GitHub Desktop.
Save eclecticmiraclecat/684729931c728aa957d5bf381862c251 to your computer and use it in GitHub Desktop.
>>> import time
>>> def after(seconds, func):
... time.sleep(seconds)
... func()
...
>>> def hello():
... print('hello world')
...
>>> def greet(name):
... print(f'hello {name}')
...
>>> after(2, hello)
hello world
>>> >>> after(2, lambda: greet('bob'))
hello bob
>>> def greeting(name):
... def greeto():
... print(f'hello {name}')
... return greeto
...
>>> after(2, greeting('bob'))
hello bob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment