Skip to content

NumpyDoc: Default value can be specified as part of the type #69

@lars-reimann

Description

@lars-reimann

At the moment, the NumpydocParser only looks at the description of a parameter to find its default value (relevant code).

However, the numpydoc style guide also allows specifying the default value as part of the type (source):

Optional keyword parameters have default values, which are displayed as part of the function signature. They can also be detailed in the description: [...] or as part of the type, instead of optional. If the default value would not be used as a value, optional is preferred. These are all equivalent:

copy : bool, default True
copy : bool, default=True
copy : bool, default: True

This is, for example, used by scikit-learn.

Moreover, the default value should be removed from the type_name property of DocstringParam, just like optional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions