英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论