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

Question: Is include the _str_signature necessary in the __str__ #190

Closed
hmaarrfk opened this issue Aug 12, 2018 · 4 comments
Closed

Question: Is include the _str_signature necessary in the __str__ #190

hmaarrfk opened this issue Aug 12, 2018 · 4 comments

Comments

@hmaarrfk
Copy link
Contributor

out += self._str_signature()

It doesn't seem natural for one to write their own signature. I would think that the str(NumpyDocString) would return the same thing that one would type themselves.

Can we take out the _str_signature?

Once again, this is in reference to designing a solution for:
#67 (comment)

Otherwise, one would need an other function that doesn't include the _str_signature() line.

@pv
Copy link
Member

pv commented Aug 12, 2018

No, if the original docstring contained the signature also the formatted one needs to contain it.

@hmaarrfk
Copy link
Contributor Author

I guess the question relates to roundtripping (PR #189):

# Signature example

from numpydoc.docscrape import FunctionDoc

def foo(bar='baz'):
    """foo does foo-like stuff

    Parameters
    ----------
    bar : str
        bar like stufff

    """
    return bar


doc = FunctionDoc(foo)

print(str(doc))

output:

.. function:: foo
    

foo(bar='baz')

foo does foo-like stuff

Parameters
----------
bar : str
    bar like stufff

.. index::

I expected it to return something like the original doc-string I typed in.

I understand if this isn't the desired usecase of numpydoc.

I understand if this

@pv
Copy link
Member

pv commented Aug 12, 2018

Perhaps --- however, please keep in mind that numpydoc has a single task that it is meant to do, generating Sphinx-formatted docstrings from Numpy-format ones, and any changes should not cause regressions to this functionality.

@hmaarrfk
Copy link
Contributor Author

Got it. I'll keep that in mind when I try to think of a good way to integrate this kind of functionality.

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

2 participants