| Бузин Никита Ильич, 511 группа FuncCount 8098 | Dimitry FuncCount 7834 | ||||
|---|---|---|---|---|---|
| f | 1 | from functools import wraps | f | 1 | from functools import wraps |
| 2 | 2 | ||||
| 3 | def counter(func): | 3 | def counter(func): | ||
| 4 | 4 | ||||
| 5 | @wraps(func) | 5 | @wraps(func) | ||
| n | 6 | def inner(*args, **kwargs): | n | 6 | def wrapper(*args, **kwargs): |
| 7 | inner._count += 1 | 7 | wrapper._count += 1 | ||
| 8 | return func(*args, **kwargs) | 8 | return func(*args, **kwargs) | ||
| n | 9 | inner._count = 0 | n | 9 | wrapper._count = 0 |
| 10 | 10 | ||||
| t | 11 | def cnt(): | t | 11 | def get_count(): |
| 12 | return inner._count | 12 | return wrapper._count | ||
| 13 | inner.counter = cnt | 13 | wrapper.counter = get_count | ||
| 14 | return inner | 14 | return wrapper | ||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||