adambard / adambard/learnxinyminutes-docs

[python/en] wrappers issue

未关闭
#4,870 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Markdown
星标
12.3k
派生
3.7k
平均合并
13 小时 10 分钟
30 天内合并 PR
6

描述

I saw 2 issues in the '7. Advanced' section:
1. In the "log_function" wrapper I don't see the '3' printed as explained:
`my_function(1,2) # => "Entering function my_function"`
` # => "3" `
` # => "Exiting function my_function"`
For the '3' to be printed I needed to add `print(result)` inside the `log_function`- I would suggest adding it.
2. The last line in the article didn't work for me- `print(my_function.__code__.co_argcount) # => ` prints 0 instead of 2 as expected. I see in debugger that `co_argcount` inside the wrapper function=2, but it prints 0 for `print(my_function.__code__.co_argcount)`.
Could it be that `co_argcount` is not supported in the functools @wraps?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。