docstring

Using javadoc for Python documentation [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 14:57:55
问题 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

Python decorator handling docstrings

此生再无相见时 提交于 2019-11-26 09:29:45
问题 I have a problem using docstrings with decorators. Given the following example: def decorator(f): def _decorator(): print \'decorator active\' f() return _decorator @decorator def foo(): \'\'\'the magic foo function\'\'\' print \'this is function foo\' help(foo) Now the help doesn\'t show me the docstring of foo as expected, it shows: Help on function _decorator in module __main__: _decorator() Without the decorator, the help is correct: Help on function foo in module __main__: foo() the