| Дударенко Денис, 527 группа FuncCount 8128 | volandlm FuncCount 7606 | ||||
|---|---|---|---|---|---|
| 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 | count = 0 | 4 | count = 0 | ||
| 5 | 5 | ||||
| n | 6 | @wraps(f) | n | 6 | @wraps(func) |
| 7 | def wrapper(*args, **kwds): | 7 | def wrapper(*args, **kwargs): | ||
| 8 | nonlocal count | 8 | nonlocal count | ||
| 9 | count += 1 | 9 | count += 1 | ||
| t | 10 | return f(*args, **kwds) | t | 10 | return func(*args, **kwargs) |
| 11 | wrapper.counter = lambda: count | 11 | wrapper.counter = lambda: count | ||
| 12 | return wrapper | 12 | return wrapper | ||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||