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

Show __init__ docstring if class has no docstring of itself #388

Closed
syntonym opened this issue Apr 18, 2015 · 5 comments
Closed

Show __init__ docstring if class has no docstring of itself #388

syntonym opened this issue Apr 18, 2015 · 5 comments
Labels

Comments

@syntonym
Copy link

I recently came accross a class that was not documented in the class docstring but only in the __init__ docstring. Thus show documentation did show the call signature of creating the class but nothing more (where I would have expected some explanation about the argument types).

Showing the docstring of __init__ if the class has no docstring of itself would be less confusing. However I don't know how common this is and if it's worth it for so few edge cases.

@davidhalter
Copy link
Owner

Good question... I like the idea. Though I'm not sure if it is a good idea since that is not the way how Python itself works. So we would encourage different behavior than Python's.

@syntonym
Copy link
Author

You are referring to help(myclass)? Jedi shows the call signature of __init__, while help(myclass) displays inheritance. Or are you referring to something different?

I personally would argue that it's better to show desirable information than being compatibel with python internals. On the other hand one could then argue that jedi should try to interpolate senseful docstrings if they are not present, e.g. jedi could try to detect the type of arguments from the usage of that function.

@davidhalter
Copy link
Owner

It's about the __doc__ attribute! help(str) will also display that. (plus inheritance).

I personally would argue that it's better to show desirable information than being compatibel with python internals.

Compatibility with Python is always great, because that's what everyone should strive for. See if you're using help(foo), you want to be able to see the docstring of foo. I want to mirror that in Jedi.

However, that is just the way I see this for the current Jedi API. This might still change with a jedi.Script.documentation command that I plan to add, because that would be an aggregate of documentation information.

@davidhalter
Copy link
Owner

There's an issue for this in Jedi. Sorry for not linking to it. I'm too lazy.

@syntonym
Copy link
Author

I think you mean this one.

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

No branches or pull requests

2 participants