I am currently beginning with Python and I have a strong PHP background and in PHP I have took the habit of using javadoc
as a documentation template.
I was wondering if javadoc
has its place as docstring
documentation in Python. What are the established conventions and/or official guildelines here?
E.g. is something like this too elaborate to fit in the Python mindset or should I try to be as concise as possible?
"""
replaces template place holder with values
@param string timestamp formatted date to display
@param string priority priority number
@param string priority_name priority name
@param string message message to display
@return string formatted string
"""
And if I am a bit too exhaustive should I go with something like this instead (where most of the documentation doesn't get printed through the __doc__
method)?
# replaces template place holder with values
#
# @param string timestamp formatted date to display
# @param string priority priority number
# @param string priority_name priority name
# @param string message message to display
#
# @return string formatted string
def format(self, timestamp = '', priority = '', priority_name = '', message = ''):
"""
replaces template place holder with values
"""
values = {'%timestamp%' : timestamp,
'%priorityName%' : priority_name,
'%priority%' : priority,
'%message%' : message}
return self.__pattern.format(**values)