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