Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Groovy equivilent to Python Docstrings?

In Python, when commenting a function, you can do it in a way that makes it easier for documentation to be automatically generated. They refer to it as a docstring.

Now that I've made an abstract class in Groovy that I'd like to pass around, is there a standard way I should comment it as well? Are there any Groovy tools to generate basic documentation from code comments?

like image 600
techHenson Avatar asked Oct 03 '14 15:10

techHenson


People also ask

Are docstrings in Python?

A Python docstring is a string used to document a Python module, class, function or method, so programmers can understand what it does without having to read the details of the implementation. Also, it is a common practice to generate online (html) documentation automatically from docstrings.

Should I use docstrings in Python?

All modules should normally have docstrings, and all functions and classes exported by a module should also have docstrings. Public methods (including the __init__ constructor) should also have docstrings. A package may be documented in the module docstring of the __init__.py file in the package directory.

How do I get Python docstrings?

Docstrings are accessible from the doc attribute (__doc__) for any of the Python objects and also with the built-in help() function. An object's docstring is defined by including a string constant as the first statement in the object's definition.

What are the three types of docstrings?

Docstrings can be further broken up into three major categories: Class Docstrings: Class and class methods. Package and Module Docstrings: Package, modules, and functions. Script Docstrings: Script and functions.


1 Answers

Documenting Groovy with Groovydoc is a nice starting point:

"Groovydoc was introduced in 2007 to provide for Groovy what Javadoc provides for Java. Groovydoc is used to generate the API documentation for the Groovy and Java classes that compose the Groovy language."

like image 112
Atzmon Hen-tov Avatar answered Oct 14 '22 15:10

Atzmon Hen-tov