
###
docstring 分为模块、函数、类、三个作用域,
如果没有指定docstring的值,返回None
"""This is the module docstring."""
def f(x):
"""This is the function docstring."""
return 2 * x
效果如下:
>>> import mymodule
>>> mymodule.__doc__
'This is the module docstring.'
>>> mymodule.f.__doc__
'This is the function docstring.'




近期评论