Created
October 1, 2019 20:07
-
-
Save MayankFawkes/002d9d76e62dc8cd606d85007ceda5e0 to your computer and use it in GitHub Desktop.
best way to use decoders
This file contains hidden or 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 threading | |
| import time | |
| from functools import wraps | |
| def thread(printd): | |
| def wrapper(function): | |
| def pw(*args, **kwargs): | |
| def process(*args, **kwargs): | |
| print("Started") | |
| function(*args, **kwargs) | |
| t=threading.Thread(target=process,args=args, kwargs=kwargs) | |
| t.start() | |
| return process | |
| return pw | |
| return wrapper | |
| def time_count(func): | |
| @wraps(func) | |
| def run(*args,**kwargs): | |
| t1=time.time() | |
| results=func(*args,**kwargs) | |
| t2=time.time() - t1 | |
| print("Time Taken {} By {}".format(t2,func.__name__)) | |
| return results | |
| return run | |
| @thread(True) | |
| @time_count | |
| def MyWebWelcome(name): | |
| time.sleep(5) | |
| print("Welcome "+name+" To my blog!") | |
| MyWebWelcome("Jack") | |
| MyWebWelcome("Jack") | |
| MyWebWelcome("Jack") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment