Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2896924

Browse files
Update decorator
1 parent 8f2cdbb commit 2896924

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

‎decorators.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33

44
def timeit(func):
5-
# This function shows the execution time of
6-
# the function object passed
5+
"""
6+
This function shows the execution time of the function object passed
7+
"""
8+
79
def wrap_func(*args, **kwargs):
8-
t1 = time()
10+
start = time()
911
result = func(*args, **kwargs)
10-
t2 = time()
11-
print(f'Function {func.__name__!r} executed in {(t2-t1):.4f}s')
12+
end = time()
13+
print(f'Function {func.__name__!r} executed in {(end-start):.4f}s')
1214
return result
15+
1316
return wrap_func

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /