What is the equivalent of Javadoc in Python? I would like to comment some code and if I use them in another class, I want the documentation shown while hovering it. I am using/trying to set up Spyder by the way.
Thanks in advance.
What is the equivalent of Javadoc in Python? I would like to comment some code and if I use them in another class, I want the documentation shown while hovering it. I am using/trying to set up Spyder by the way.
Thanks in advance.
 
    
    This is how you write a docstring in python:
def square_root(n):
    """Calculate the square root of a number.
    Args:
        n: the number to get the square root of.
    Returns:
        the square root of n.
    Raises:
        TypeError: if n is not a number.
        ValueError: if n is negative.
    """
    pass
The format is not unified and can conform for example to:
"""
This is a reST style.
:param param1: this is a first param
:param param2: this is a second param
:returns: this is a description of what is returned
:raises keyError: raises an exception
"""
"""
This is an example of Google style.
Args:
    param1: This is the first param.
    param2: This is a second param.
Returns:
    This is a description of what is returned.
Raises:
    KeyError: Raises an exception.
"""
"""
My numpydoc description of a kind
of very exhautive numpydoc format docstring.
Parameters
----------
first : array_like
    the 1st param name `first`
second :
    the 2nd param
third : {'value', 'other'}, optional
    the 3rd param, by default 'value'
Returns
-------
string
    a value in a string
Raises
------
KeyError
    when a key error
OtherError
    when an other error
"""
