| Сотникова Виктория Сергеевна, 407 группа FuncCount 8107 | Aleksey FuncCount 11690 | ||||
|---|---|---|---|---|---|
| f | 1 | from functools import wraps | f | 1 | from functools import wraps |
| 2 | 2 | ||||
| n | 3 | def counter(f): | n | 3 | def counter(fn): |
| 4 | cnt = 0 | 4 | n = 0 | ||
| 5 | 5 | ||||
| t | 6 | @wraps(f) | t | 6 | @wraps(fn) |
| 7 | def wrapper(*args, **kwargs): | 7 | def wrap(*args, **kwargs): | ||
| 8 | nonlocal cnt | 8 | nonlocal n | ||
| 9 | cnt += 1 | 9 | n += 1 | ||
| 10 | return f(*args, **kwargs) | 10 | return fn(*args, **kwargs) | ||
| 11 | wrapper.counter = lambda: cnt | 11 | wrap.counter = lambda: n | ||
| 12 | return wrapper | 12 | return wrap | ||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||