Answer the question
In order to leave comments, you need to log in
Documentation/comments in Django?
Is there any style guide on how to comment classes correctly and what to write there? They did a code review for me, and so here is an example of a comment, as is approximately clear. But if the style guide?
"""
Check if current user role matches to given.
@:param role: user role.
@:type role: int.
@:rtype bool.
@:return True if user matches given role. Else returns false.
"""
Answer the question
In order to leave comments, you need to log in
There are style guides and formats.
Official guide: PEP 257
Everything else there is IDE convenience. I see your format for the first time, they usually use reST for PyCharm.
"""
Описание, что делает метод/функция
:param param1: Что за параметр принимается
:param param2: Ещё один параметр, который принимается
:returns: Какое значение возвращается
:raises KeyError: В каком случае рейзится эта ошибка
"""
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question