The summary line for a class docstring should fit on one line.
If the class has public attributes, they may be documented here in an Attributes section and follow the same formatting as a function's Args section. Alternatively, attributes may be documented inline with the attribute's declaration (see __init__ method below).
Methods
example_method
- Quick example
__special__
- Dunder methods are considered public
__special_without_docstring__
- Undocumented text will appear.
Note
The "Methods" section is supported only as a "best effort" basis.
See Also
Google style "See Also" section is just like any admonition.
Method | __init__ |
Example of docstring on the __init__ method. |
Method | __special__ |
Dunder methods are considered public and will be included in the output. |
Method | __special |
Undocumented |
Method | example |
Class methods are similar to regular functions. |
Method | readwrite |
Undocumented |
Instance Variable | attr1 |
Description of attr1 . |
Instance Variable | attr2 |
Description of attr2 . |
Instance Variable | attr3 |
Undocumented |
Instance Variable | attr4 |
Undocumented |
Instance Variable | attr5 |
Docstring after attribute, with type specified. |
Property | readonly |
Properties should be documented in their getter method. |
Property | readwrite |
Properties with both a getter and setter should only be documented in their getter method. |
Method | _private |
Private members are any methods or attributes that start with an underscore and are not special. |
Method | _private |
Undocumented |
Example of docstring on the __init__ method.
The __init__ method should be documented as a docstring on the __init__ method.
Note
Do not include the self parameter in the Args section.
Parameters | |
param1:str | Description of param1. |
param2:int , optional | Description of param2. Multiple lines are supported. |
param3:list(str) | Description of param3. |
Properties with both a getter and setter should only be documented in their getter method.
If the setter method contains notable behavior, it should be mentioned here.