How to write Python document comments (Docstrings). Hi, a faction? school? There seems to be.
NumPy style.py
def add(a, b):
"""The sum of two numbers.
"""
Google style.py
def add(a, b):
"""The sum of two numbers.
"""
NumPy style.py
def add(a, b):
"""The sum of two numbers.
(Extended Summary)
"""
Google style.py
def add(a, b):
"""The sum of two numbers.
(Extended Summary)
"""
NumPy style.py
"""
Parameters
----------
x : type
Description of parameter `x`.
y
Description of parameter `y` (with type not specified)
"""
Google style.py
"""
Args:
x (type): Description of parameter `x`.
y: Description of parameter `y` (with type not specified)
"""
NumPy style.py
"""
Returns
-------
int
Description of anonymous integer return value.
"""
NumPy style.py
"""
Returns
-------
err_code : int
Non-zero value indicates error code, or zero on success.
err_msg : str or None
Human readable error message, or None on success.
"""
Google style.py
"""
Returns:
int: Description of anonymous integer return value.
"""
NumPy style.py
"""
Raises
------
LinAlgException
If the matrix is not numerically invertible.
"""
Google style.py
"""
Raises:
LinAlgException: If the matrix is not numerically invertible.
"""
NumPy style.py
"""
See Also
--------
average : Weighted average
"""
Google style.py
#None
NumPy style.py
"""
Notes
----------
The FFT is a fast implementation of the discrete Fourier transform:
.. math:: X(e^{j\omega } ) = x(n)e^{ - j\omega n}
"""
Google style.py
"""
Note:
The FFT is a fast implementation of the discrete Fourier transform:
.. math:: X(e^{j\omega } ) = x(n)e^{ - j\omega n}
"""
NumPy style.py
"""
Examples
----------
>>> np.add(1, 2)
3
"""
Google style.py
"""
Example:
>>> np.add(1, 2)
3
"""
NumPy style.py
"""
Attributes
----------
x : float
The X coordinate.
y : float
The Y coordinate.
"""
Google style.py
"""
Attributes:
x (float): The X coordinate.
y (float): The Y coordinate.
"""
NumPy style.py
"""
Methods
-------
colorspace(c='rgb')
Represent the photo in the given colorspace.
gamma(n=1.0)
Change the photo's gamma exposure.
"""
Google style.py
#None
Recommended Posts