Answers for "using docstring in python"

1

using docstring in python

#A docstring is a string literal that occurs as the first statement in a module, 
#function, class, or method definition. Such a docstring becomes the __doc__ special 
#attribute of that object. 
#They serve as documentation or explanation to a statement in a function, class or 
#method definition. They are kept in a triple quotation mark.


def complex(real=0.0, imag=0.0):
    """Form a complex number.

    Keyword arguments:
    real -- the real part (default 0.0)
    imag -- the imaginary part (default 0.0)
    """
    if imag == 0.0 and real == 0.0:
        return complex_zero
    ...
Posted by: Guest on September-02-2021

Code answers related to "using docstring in python"

Python Answers by Framework

Browse Popular Code Answers by Language