Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import time
- def elapsed_time(functor):
- def decorated(*args, **kwargs):
- start = time.time()
- functor()
- end = time.time()
- print "Elapsed time: %f" % (end-start)
- return decorated
- @elapsed_time
- def sum_function():
- sum = 0
- #for i in xrange(1,1000000+1,1):
- for i in xrange(1,1000000000+1,1):
- sum += i
- print sum
- if __name__ == "__main__":
- sum_function()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement