from time import time def timer(any_function): def count_time(): start = time() any_function() stop = time() print("%.15f"%(stop-start),'seconds') return return count_time @timerdef hello(): print("Hello World") return @timerdef another_function(): for item in [1,2,3,4,5,6,7,8,9]: print("%d "%item,end='') print() return hello() another_function()
20 December 2017
Example of decorator in pyhon
Subscribe to:
Post Comments (Atom)
-
/*** Md. Nazmul Hasan Shahjalal University of Science & Technology,Sylhet. hasan08sust@gmail.com ***/ #include<iostream> #i...
-
n = 1 while n: str = input () # print('Case no# %d :'%n) if str == ' * ' : break if str == ' Hajj ...
-
/*** Md. Namzul Hasan Shahjalal University of Science & technology,sylhet. hasan08sust@gmail.com ***/ #include<bits/stdc++.h...
No comments:
Post a Comment