| Гудов Дмитрий 321 FuncCount 8211 | volandlm FuncCount 7606 | ||||
|---|---|---|---|---|---|
| f | 1 | from functools import wraps | f | 1 | from functools import wraps |
| 2 | 2 | ||||
| n | 3 | def counter(f): | n | 3 | def counter(func): |
| 4 | cnt = 0 | 4 | count = 0 | ||
| 5 | 5 | ||||
| n | 6 | @wraps(f) | n | 6 | @wraps(func) |
| 7 | def wrapper(*args, **kwargs): | 7 | def wrapper(*args, **kwargs): | ||
| t | 8 | nonlocal cnt | t | 8 | nonlocal count |
| 9 | cnt += 1 | 9 | count += 1 | ||
| 10 | return f(*args, **kwargs) | 10 | return func(*args, **kwargs) | ||
| 11 | wrapper.counter = lambda: cnt | 11 | wrapper.counter = lambda: count | ||
| 12 | return wrapper | 12 | return wrapper | ||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||