Skip to content

Commit 9428d94

Browse files
committed
fn_w_counter updated
1 parent d120706 commit 9428d94

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Week04/functions_tarik_bozgan.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ def custom_equation(x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int
1616

1717

1818
def fn_w_counter() -> tuple[int, dict[str, int]]:
19-
caller = __name__ if __name__ != "<lambda>" else "lambda"
19+
caller = __name__
20+
2021
fn_w_counter.total = getattr(fn_w_counter, "total", 0) + 1
2122
fn_w_counter.callers = getattr(fn_w_counter, "callers", {})
23+
2224
fn_w_counter.callers[caller] = fn_w_counter.callers.get(caller, 0) + 1
25+
2326
return fn_w_counter.total, fn_w_counter.callers.copy()

0 commit comments

Comments
 (0)