If a class contains a optional documentation string -- a string that describes the class, the string must appear in the line or lines following the class header. A user can view a class’s documentation string by executing the following statement.
print ClassName.__doc__
Modules, methods and functions also may specify a documentation string.
By convention, docstrings are triple-quoted strings. This convention allows the class author
to expand a program’s documentation (e.g., by adding several more lines) without having to
change the quote style.
No comments:
Post a Comment