| Иншаков Константин Андреевич, 525 группа FuncCount 7734 | Dimitry FuncCount 7834 | ||||
|---|---|---|---|---|---|
| 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 | 4 | ||||
| n | 5 | @wraps(f) | n | 5 | @wraps(func) |
| 6 | def helper(*args, **kwargs): | 6 | def wrapper(*args, **kwargs): | ||
| 7 | helper.calls += 1 | 7 | wrapper._count += 1 | ||
| 8 | return f(*args, **kwargs) | 8 | return func(*args, **kwargs) | ||
| 9 | helper.calls = 0 | 9 | wrapper._count = 0 | ||
| 10 | 10 | ||||
| t | 11 | def tmp(): | t | 11 | def get_count(): |
| 12 | return helper.calls | 12 | return wrapper._count | ||
| 13 | helper.counter = tmp | 13 | wrapper.counter = get_count | ||
| 14 | return helper | 14 | return wrapper | ||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||