Python代码的自动补全和文档化

huangapple go评论83阅读模式
英文:

Auto-completion & documentation of Python code

问题

你可以使用 index.d.ts 来启用Python代码的自定义代码文档和自动完成,就像我们在JS中做的那样吗?如果可以,怎么做?如果不行,是否有Python的等效方法?

英文:

Can I use index.d.ts to enable custom code documentation & auto-completion for Python code as we do in JS? if so, how? If not, is there any equivalent for Python?

答案1

得分: 1

是的,随着时间的推移,Python 已经进行了各种添加,允许您这样做。

如评论中所提到的,https://www.python.org/dev/peps/pep-0526/ 和 https://www.python.org/dev/peps/pep-0257/ 在某种程度上涵盖了这个问题。

还可以在这里查看有关类型提示的文档 https://docs.python.org/3/library/typing.html

请注意,如果您想知道如何为一个非常具体的示例提供类型提示,您应该可能包含一些需要提示的示例代码,但希望上述内容对您有所帮助。

英文:

Yes, there have been various additions to Python over time that allow you to do so.

As mentioned in the comments, https://www.python.org/dev/peps/pep-0526/ and https://www.python.org/dev/peps/pep-0257/ cover this in part.

See also the documentation on type hints here https://docs.python.org/3/library/typing.html

Note that if you wanted to know how to provide type hints for a very specific example, you should have probably included some sample code that needed the hints, but hopefully the above helps.

huangapple
  • 本文由 发表于 2020年1月6日 15:38:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/59608306.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定