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

How to handle doc strings #54

Closed
jlapeyre opened this issue Aug 11, 2022 · 1 comment · Fixed by #73
Closed

How to handle doc strings #54

jlapeyre opened this issue Aug 11, 2022 · 1 comment · Fixed by #73

Comments

@jlapeyre
Copy link

How do doc strings work with several methods? It would be nice to put different doc strings in different methods. I don't think this works.

Is there a recommended way then ? Maybe put one big doc string in the first method?

@wesselb
Copy link
Member

wesselb commented Aug 11, 2022

Hey @jlapeyre!

Currently, the docstring of the first definition of a function is used. Example:

from plum import dispatch


@dispatch
def f(x: str):
    """Do something."""
    pass


@dispatch
def f(x: int):
    """Do more."""
    pass


print(f.__doc__)  # "Do something."

Ideally, all docstrings would be appended in some sane way. E.g., for the above example, f.__doc__ would ideally be

f(x: str)

Do something.

—

f(x: int)

Do more.

I've tagged this issue as a feature request. I think this would be a nice improvement!

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

Successfully merging a pull request may close this issue.

2 participants