how_to_write_docstring.py 436 Bytes
Newer Older
BO ZHANG's avatar
BO ZHANG committed
1
2
3
import numpy as np


BO ZHANG's avatar
BO ZHANG committed
4
# a function to be finished
BO ZHANG's avatar
BO ZHANG committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
def cos_to_be_finished(x):
    # TODO: to be finished
    return


# a function with a simple docstring
def _cos(x):
    """ this is a cosine function """
    return np.cos(x)


# a function with a complete docstring
def cos(x: float = 0.):
    """ cosine function

    Parameters
    ----------
    x :
        x values

    Returns
    -------
    cos(x)

    """
    return np.cos(x)