Created
February 4, 2019 18:42
-
-
Save audebert/78ca6b911c5a6d8d98ccc35a042c4ee7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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