| Анастасия Иванова, группа 517 FuncCount 8434 | 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 | ||||
| n | 5 | @wraps(f) | n | 5 | @wraps(func) |
| 6 | def wrapper(*args, **kwargs): | 6 | def wrapper(*args, **kwargs): | ||
| t | 7 | wrapper.cnt_call += 1 | t | 7 | wrapper.count += 1 |
| 8 | return f(*args, **kwargs) | 8 | return func(*args, **kwargs) | ||
| 9 | wrapper.cnt_call = 0 | 9 | wrapper.count = 0 | ||
| 10 | wrapper.counter = lambda: wrapper.cnt_call | 10 | wrapper.counter = lambda: wrapper.count | ||
| 11 | return wrapper | 11 | return wrapper | ||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||