| action22k FuncCount 8409 | david_Yakhin_312 FuncCount 8197 | ||||
|---|---|---|---|---|---|
| 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) | ||
| 6 | def wrapper(*args, **kwargs): | 6 | def wrapper(*args, **kwargs): | ||
| n | 7 | wrapper.count += 1 | n | 7 | wrapper._count += 1 |
| 8 | return func(*args, **kwargs) | 8 | return func(*args, **kwargs) | ||
| t | 9 | wrapper.count = 0 | t | 9 | wrapper._count = 0 |
| 10 | wrapper.counter = lambda: wrapper.count | 10 | wrapper.counter = lambda: wrapper._count | ||
| 11 | return wrapper | 11 | return wrapper | ||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||