| Алтухов Егор, 321 группа FuncCount 7928 | action22k FuncCount 8409 | ||||
|---|---|---|---|---|---|
| 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 f(*args, **kwargs): | n | 6 | def wrapper(*args, **kwargs): |
| 7 | f._count += 1 | 7 | wrapper.count += 1 | ||
| 8 | return func(*args, **kwargs) | 8 | return func(*args, **kwargs) | ||
| t | 9 | f._count = 0 | t | 9 | wrapper.count = 0 |
| 10 | f.counter = lambda: f._count | 10 | wrapper.counter = lambda: wrapper.count | ||
| 11 | return f | 11 | return wrapper | ||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||