Skip to content

Commit 693c05b

Browse files
authored
functions_miray_cengil.py
1 parent 7724b61 commit 693c05b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Week04/functions_miray_cengil.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
custom_power = lambda x=0, e=1: x ** e
1+
custom_power = lambda x=0, /, e=1: x ** e
22

33
def custom_equation(x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int = 1) -> float:
44

@@ -21,9 +21,10 @@ def custom_equation(x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int
2121

2222
call_count = defaultdict(int)
2323

24-
def fn_w_counter()-> (int, dict[str, int]):
24+
def fn_w_counter() -> (int, dict[str, int]):
2525
"""A function that counts the number of calls."""
26-
caller_name = inspect.stack()[1].function # Get the name of the calling function
26+
caller_name = inspect.currentframe().f_back.f_code.co_name # Get the name of the calling function
27+
2728

2829
# Increment the global counter
2930
call_count[caller_name] += 1

0 commit comments

Comments
 (0)