class documentation

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_without_docstring__ Undocumented
Method example_method Class methods are similar to regular functions.
Method readwrite_property.setter 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_property Properties should be documented in their getter method.
Property readwrite_property 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_without_docstring Undocumented
def __init__(self, param1, param2, param3): (source)

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:strDescription of param1.
param2:int, optionalDescription of param2. Multiple lines are supported.
param3:list(str)Description of param3.
def __special__(self): (source)

Dunder methods are considered public and will be included in the output.

def __special_without_docstring__(self): (source)

Undocumented

def example_method(self, param1, param2): (source)

Class methods are similar to regular functions.

Note

Do not include the self parameter in the Args section.

Parameters
param1The first parameter.
param2The second parameter.
Returns
tuple(str, str, int, tuple(str, str))A complicated result.
@readwrite_property.setter
def readwrite_property(self, value): (source)

Undocumented

Description of attr1.

attr2: List[Union[str, bytes, int]], optional = (source)

Description of attr2.

Undocumented

Undocumented

Docstring after attribute, with type specified.

@property
readonly_property = (source)

Properties should be documented in their getter method.

@property
readwrite_property = (source)

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.

def _private(self): (source)

Private members are any methods or attributes that start with an underscore and are not special.

By default they are hidden, they can be displayed with the "Show Private API" button.

def _private_without_docstring(self): (source)

Undocumented