| Маркин Игорь, 523 группа FuncCount 8183 | action22k FuncCount 8409 | ||||
|---|---|---|---|---|---|
| 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 | ||||
| t | 5 | @wraps(f) | t | 5 | @wraps(func) |
| 6 | def wrap_cnt(*args, **kwargs): | 6 | def wrapper(*args, **kwargs): | ||
| 7 | wrap_cnt.cnt += 1 | 7 | wrapper.count += 1 | ||
| 8 | return f(*args, **kwargs) | 8 | return func(*args, **kwargs) | ||
| 9 | wrap_cnt.cnt = 0 | 9 | wrapper.count = 0 | ||
| 10 | wrap_cnt.counter = lambda: wrap_cnt.cnt | 10 | wrapper.counter = lambda: wrapper.count | ||
| 11 | return wrap_cnt | 11 | return wrapper | ||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||