| Елизавета Череменина, 411 группа FuncCount 8085 | volandlm FuncCount 7606 | ||||
|---|---|---|---|---|---|
| f | 1 | from functools import wraps | f | 1 | from functools import wraps |
| 2 | 2 | ||||
| 3 | def counter(func): | 3 | def counter(func): | ||
| 4 | count = 0 | 4 | count = 0 | ||
| 5 | 5 | ||||
| 6 | @wraps(func) | 6 | @wraps(func) | ||
| n | 7 | def wrapped(*args, **kwargs): | n | 7 | def wrapper(*args, **kwargs): |
| 8 | nonlocal count | 8 | nonlocal count | ||
| 9 | count += 1 | 9 | count += 1 | ||
| 10 | return func(*args, **kwargs) | 10 | return func(*args, **kwargs) | ||
| t | 11 | wrapped.counter = lambda: count | t | 11 | wrapper.counter = lambda: count |
| 12 | return wrapped | 12 | return wrapper | ||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||