docstrings python code example
Example 1: python function docstring
def functionName():
"""
This is a function docstring
"""
Example 2: docstrings in python
def titled_name(name):
"""This function takes name and returns it in a title case or in other
words it will make every first letter of a word Capitalized"""
return f"{name}".title()
Example 3: python get function docstring
help(functionName)
Example 4: python docstring
def complex(real=0.0, imag=0.0):
"""Form a complex number
Args:
real (float, optional): The real part. Defaults to 0.0.
imag (float, optional): The imaginary part. Defaults to 0.0.
"""
if imag == 0.0 and real == 0.0:
return complex_zero
...