Skip to content

Instantly share code, notes, and snippets.

@audebert
Created February 4, 2019 18:42
Show Gist options
  • Save audebert/78ca6b911c5a6d8d98ccc35a042c4ee7 to your computer and use it in GitHub Desktop.
Save audebert/78ca6b911c5a6d8d98ccc35a042c4ee7 to your computer and use it in GitHub Desktop.
import time
import threading
def foo():
print('foo')
def bar():
print('bar')
for func in [foo, bar]:
def delayed():
time.sleep(1)
func()
t = threading.Thread(target=delayed)
t.daemon = True
t.start()
def func():
print('lol')
time.sleep(2)
# Output:
# lol
# lol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment