List a property as a class method
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 355
- Forks
- 181
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 3
Description
In scikit-learn, we have the following use-case.
We want a class method (e.g. predict_proba) to only be defined under some condition meaning that hasattr(instance, "class_method") should return False or True depending of some internal class attributes. The trick used to get this behaviour is to implement this class method as a property where we can implement a checking mechanism which can raise an AttributeError allowing to use hasattr.
With this hack, the property is not listed in the summary of the methods: https://scikit-learn.org/dev/modules/generated/sklearn.linear_model.SGDClassifier.html#sklearn.linear_model.SGDClassifier
We still get the property documented with the other methods thought.
I was wondering if there is any mechanism such that we could get this property shown in the methods toc?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository file, test, or implementation entry point; begin by reproducing the linked scikit-learn generated documentation and tracing how numpydoc builds the methods table of contents. Done means establishing whether a documented property can appear in that methods TOC and covering the conditional-method case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, scikit-learn
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100