0

I am deriving a ChildClass from a BaseClass. Both classes have docstrings.

I am wondering how I can get/show the BaseClass' docstring when calling the ChildClass.

from dataclasses import dataclass


@dataclass
class BaseClass:
    """Base class.

    This is the base class.

    Parameters
    ----------
    arg1
        The first string.
    arg2
        The second string.

    """

    arg1: str
    arg2: str


@dataclass
class ChildClass(BaseClass):
    """Child class.

    This is the child class. It extends the base class.

    Parameters
    ----------
    arg3
        The third string.

    """

    arg3: str



print(Child.__doc__)

Child class.
    This is the child class. It extends the base class.
    Parameters
    ----------
    arg3
        The third string.

Is this behavior expected or can I see some kind of concatenated docstring?

Andi
  • 3,196
  • 2
  • 24
  • 44

0 Answers0