codehint是一个用于在运行时在控制台中描述python函数和方法的包。
codehint的Python项目详细描述
codehint是一个包,用于在运行时描述python控制台中的函数。 它的工作方式与高级ide显示函数提示时的工作方式相同,但打印到 控制台而不是窗口
示例
如果在代码中定义了以下函数:
>>>defhello(a,b:int,c)->int:...""" ... Hello, this is an explanation ... of what this is going to do ... :param a: foo ... :param b: bar example ... :param c: ... :return: True if good, False otherwise. ... """...x=a+b*2*c...returnx
稍后可以用codehint描述它:
>>>fromcodehintimporthint>>>hint(hello)
结果是
------------------------ def hello(a, b:int, c) -> int: Hello, this is an explanation of what this is going to do=== Parameters: 3======[0] a (type Any) -> foo [1] b (type int) -> bar example [2] c (type Any) -> ======================== Result (type int) -> True if good, False otherwise.
当前只能用于描述函数或方法的签名
安装
仅支持python 3.4.1以后的版本:
sudo pip3 install codehint
许可证
它是根据mit许可证发布的。