Python docstring



docstring or Python documentation string is a way of documenting Python modules, functions, classes. PEP 257 standardize the high-level structure of docstrings. __doc__ attribute can be used to print the docstring.
Example of defining docstring:
>>> def test_doc_string():
...    """ this is a docstring for function test_doc_string """
...
>>> test_doc_string.__doc__
' this is a docstring for function test_doc_string '

No comments:

Post a Comment