[英]Python: docstrings and type annotations
Having a function like: 有这样的功能:
def foo(x: int) -> float:
return float(x)
I would like to use a NumPy-like docstring like the following: 我想使用类似NumPy的文档字符串,如下所示:
def foo(x: int) -> float:
"""
Parameters
----------
x
Input parameter
Returns
-------
The output value.
"""
return float(x)
Note that: 注意:
Is there a Sphinx extension that supports that? 是否有支持它的Sphinx扩展? Would you recommend another syntax? 你会推荐另一种语法吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.