-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Properties are shown as var #276
Comments
This part came from the original pdoc and so far hasn't been touched (or, at least, revised into a different manner). We only know about not even a handful of objects: modules, classes, functions and variables. Lines 985 to 993 in d776cbd
It's a major simplification, which I kind of like, but otherwise agree with all your points. 😕 |
Hmm, I do not know much about Python internals but for a member of some class C, I think it is not too hard to find out of the
So this could still get listed under "Instance variables" but with a prefix "property" instead of "var". It is probably harder to figure out of the property also has a setter or not. If this can be done, then it would be cool to have "read only property" in the docs if there is no setter and otherwise just "property", I think. Or some other way to indicate this. |
Unlike Lines 1235 to 1240 in d776cbd
the 'var' before variables comes from the template: Lines 235 to 237 in d776cbd
And that's not the place for further complex logic. (Although you're welcome to suit it to your needs.) It's not hard to discern properties, access setters too, but there's currently no extra supporting API in place; this would probably not be a minor/trivial change. But if you're willing to work on it, I'd certainly have a look! The reasoning behind properties being instance variables is that they do, normally, depend on (some computation upon) |
Thanks! I have implemented something for this which works for me but I am not sure that I have not overlooked The concrete way how to show this is obviously a matter of taste. I would very much like it if the documentation would indicate read-only properties (which only have a getter) vs. other properties which may have a setter and/or a getter. In my fix i have called the former "ro-property" and the latter just "property". See #277 |
The generated documentation for a property:
is shown as "var weight : int" but it would be more useful if the fact that this is a property would get shown, e.g.
"property weight: int" as the Sphinx generator does.
This is also shown under the header "Instance variables" which is not exactly right.
Also, if there is a separate setter for the property:
this is not reflected in the documentation, so there is no way to see from the documentation if the property can only be read or set as well. Only the docstring of the getter method is included in the generated documentation.
The text was updated successfully, but these errors were encountered: