Skip to content

Commit 3dfc446

Browse files
committed
Bugs got fixed
1 parent 662d77f commit 3dfc446

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

Week04/decorators_tarik_bozgan.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
custom_power = lambda x, e=1: x ** e
2-
3-
def custom_equation(x, y, a=1, b=1, *, c=1):
4-
return (x ** a + y ** b) / c
5-
6-
_calls = {}
7-
8-
def fn_w_counter():
9-
caller = __import__('inspect').currentframe().f_back.f_code.co_name
10-
_calls[caller] = _calls.get(caller, 0) + 1
11-
return _calls[caller], dict(_calls)
12-
131
def performance(f):
142
def w(*a, **k):
153
import time, tracemalloc

Week04/functions_tarik_bozgan.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
def custom_power(x, e=1):
2-
return x ** e
1+
custom_power = lambda x, e=1: x ** e
32

43
def custom_equation(x, y, a=1, b=1, *, c=1):
54
return (x ** a + y ** b) / c
65

7-
call_counts = {}
6+
_calls = {}
87

98
def fn_w_counter():
10-
caller_name = __import__('inspect').currentframe().f_back.f_code.co_name
11-
call_counts[caller_name] = call_counts.get(caller_name, 0) + 1
12-
return (call_counts[caller_name], {k: v for k, v in call_counts.items()})
9+
caller = __import__('inspect').currentframe().f_back.f_code.co_name
10+
_calls[caller] = _calls.get(caller, 0) + 1
11+
return _calls[caller], dict(_calls)

0 commit comments

Comments
 (0)