-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
mouredev.py
64 lines (44 loc) · 969 Bytes
/
mouredev.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""
Ejercicio
"""
def print_call(function):
def print_function():
print(f"La función '{function.__name__}' ha sido llamada.")
return function
return print_function
@print_call
def example_function():
pass
@print_call
def example_function_2():
pass
@print_call
def example_function_3():
pass
example_function()
example_function_2()
example_function_3()
"""
Extra
"""
def call_counter(function):
def counter_function():
counter_function.call_count += 1
print(
f"La función '{function.__name__} se ha llamado {counter_function.call_count}' veces.")
return function
counter_function.call_count = 0
return counter_function
@call_counter
def example_function_4():
pass
@call_counter
def example_function_5():
pass
example_function_4()
example_function_4()
example_function_4()
example_function_4()
example_function_5()
example_function_4()
example_function_5()