Хайруллина Алина FuncCount 8423
Aleksey FuncCount 8091
f1from functools import wrapsf1from functools import wraps
22
3def counter(func):3def counter(func):
n4    calls = 0n4    count = 0
55
6    @wraps(func)6    @wraps(func)
7    def wrapper(*args, **kwargs):7    def wrapper(*args, **kwargs):
n8        nonlocal callsn8        nonlocal count
9        calls += 19        count += 1
10        return func(*args, **kwargs)10        return func(*args, **kwargs)
1111
t12    def get_counter():t12    def counter_method():
13        return calls13        return count
14    wrapper.counter = get_counter14    wrapper.counter = counter_method
15    return wrapper15    return wrapper
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op