-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Typing] 为 Paddle 框架 API 添加类型提示(Type Hints)的项目总结。 #68
Conversation
✅ Deploy Preview for pfccblog ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 👍🏻 👍🏻
太赞了。
- 粒度控制 | ||
- 单元测试 | ||
|
||
所谓「粒度控制」是指,很难用统一的标注来划分哪些类型需要归类入 `_typing`,哪些则直接使用 Python 的基础类型进行组合。比如,`_typing` 中的 `IntSequence = Sequence[int]`,很多地方都会用到,但,具体到每个接口,也许直接标注 `Sequence[int]` 会更简单。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个要不提个 PR 都替换了吧,直接用 Sequence[int]
就行了,这个应该是直接从 paddlepaddle-stubs 搬过来的,paddlepaddle-stubs 早期用的是 IntSequence = tuple[int, ...] | list[int]
,后来改成 IntSequence = Sequence[int]
也没删,但实际上没啥必要
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
提了个 PR 删了 PaddlePaddle/Paddle#67929
src/posts/type-hints-project.md
Outdated
<div style="display: flex; justify-content: center"> | ||
<figure style="width: 80%;"> | ||
<img src="../images/type-hints-project/typing_module.png"/> | ||
<figcaption>typing_module.pyi</figcaption> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里使用 .pyi
还是 .png
是怎么确定的?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.png
~ 这里写错了 ~
昨晚写的有点累,偷懒 figcaption
跟 src
用同一个名字了,其实用中文会更好 ... ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我统一改一下吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为 Paddle 框架 API 添加类型提示(Type Hints)的项目总结。
关联:PaddlePaddle/Paddle#63597
@sunzhongkai588 @SigureMo @luotao1
请评审 ~