Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lars-reimann opened this issue Jul 15, 2022 · 0 comments
Open

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

lars-reimann opened this issue Jul 15, 2022 · 0 comments

Comments

@lars-reimann
Copy link
Contributor

lars-reimann commented Jul 15, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant