I want to document a class, and I have seen that in PyCharm when a docstring is added automatically it adds
:param param_name1:
:param param_name2:
However, I have seen that some people use
@param param_name1:
@param param_name2:
I wonder which of both is valid, and which one is the one that a Pythonista should house.
I also wonder if I should include the @type
or :type
for describing the data type of a parameter.
"""
:type rating: int
:param rating: hotel rating
"""
This is the way I am writing my docstring. So, is it okay or is there a much better way or stand way to do it?
As explained in https://www.jetbrains.com/pycharm/help/using-docstrings-to-specify-types.html#d331661e129
:param param_name1:
:param param_name2:
is reStructuredText format instead of
@param param_name1:
@param param_name2:
is Epitext format
Epitext format can be enabled with File > Settings > Python Integrated Tools and set "Docstring format" to "Epytext"