question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: Add default parameter values to docstring

See original GitHub issue

Currently the docstrings for Module subclasses don’t display the default argument values when using ?. Not sure if there is an automated way to display this, or to update all of the docstrings.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
patrick-kidgercommented, Jul 25, 2022

Ah, this will probably be because it’s grabbing the metaclass __call__ rather than using the class __init__. (I suppose help must have some special-casing internally to not exhibit the same behaviour for type.__call__.)

I think overriding cls.__signature__ is probably the correct thing to do. I’d be happy to accept a PR fixing this.

1reaction
patrick-kidgercommented, Jul 24, 2022

I’m not sure what you mean about ? - I assume this is in reference to some piece of tooling you use?

In any case, I’d be happy to include default parameters in docstrings. It may be possible to do this in automated fashion either now or in the future. See this Reddit thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the standard way for writing default values in a python ...
I have a function with parameters set to default values. I'm using a NumPy-style docstring, but I've seen the default values written ...
Read more >
Python Docstring: Documenting And Introspecting Functions
A dict containing default values for keyword-only parameters. A str which is the function name. A str which is the function's qualified name....
Read more >
Python docstring: some default arguments values are missing
Hi, we're thinking of moving from 2.0.12 to 3.0.12 (it's about time), but one thing holding us back at the moment is that...
Read more >
pandas docstring guide - Python-Sprints
For keyword arguments with a default value, the default will be listed after a comma at the end of the type. The exact...
Read more >
Documenting Python APIs with docstrings
Optional keyword parameters have default values, which are automatically documented as part of the function or method's signature. You can also explain defaults...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found