Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Attribute docstring does not show properly when there is a property with the same name #31595

Open
@GaetandeCast

Description

@GaetandeCast

Describe the issue linked to the documentation

When a @Property is documented by a docstring and when the corresponding fitted attribute with the same name is also documented in the docstring of the class, the documentation only displays the first line of the docstring of the @Property. The name of the property is also not properly rendered.
For example estimators_samples_ of BaggingClassifier is displayed like this in the documentation:

Image

Although its docstring is:

Image

And the docstring of the @property is:

Image

This was probably introduced here : #30989

Suggest a potential alternative/fix

One solution is to remove the docstring of the property, in which case the docstring of the attribute will be rendered properly. But it would have to be done in all such cases. I discovered it while working on RandomForestClassifier.feature_importances_ that suffers from the same issue.

Cc: @antoinebaker @lesteve What do you think would be the right way to document an attribute coming from a property?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions