DocstringsΒΆ
You can use a special type of comment called a docstring. At the top of a script and after the beginning of any function definition, you can put a specially formatted string to provide inline documentation about that script or function. These special strings are called docstrings.
Docstrings should be delimited with three single quote characters ('''
) or three double quote characters
("""
). (Use double quotes if your string will span more than one line.) Here are some examples:
"""This could be the docstring at the top of a source file,
explaining what the purpose of the file is"""
def printHello():
"""this function prints a short greeting"""
print("hello")