Created
July 21, 2015 22:40
-
-
Save pcote/fffcc396be0466e21818 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
from threading import Thread | |
from random import random, seed | |
from time import time, sleep | |
from functools import wraps | |
def concurrent(func): | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
Thread(target=func, args=args).start() | |
return wrapper | |
@concurrent | |
def argue(sentence): | |
seed(time()) | |
for word in sentence.split(): | |
sleep(random()) | |
print(word) | |
if __name__ == '__main__': | |
argue("Python is terrible because of significant whitespace.") | |
argue("Oh yeah, well Java is worse because it's verbose") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment