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

Doc-comment class Doc2Vec only via __init__ method #2607

Closed
wants to merge 3 commits into from

Conversation

gojomo
Copy link
Collaborator

@gojomo gojomo commented Sep 23, 2019

For consideration/discussion: having both a class doc-comment, and an __init__ method doc-comment, means both are stitched together in HTML docs (https://radimrehurek.com/gensim/models/doc2vec.html#gensim.models.doc2vec.Doc2Vec), and the parameter-details that every user needs to consult wind up below the confusing mess of internal-attributes that hardly anyone cares about. Google's Python doc-comment conventions suggest that a class and its parameters can be documented either under the class declaration, or under the __init__ method, but not split between both. (See, eg: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html). Here I've moved the notes about the class under __init__(), as that seems to get the most important info – init parameters - to where both code- and doc- readers will most easily find it.

For consideration/discussion: having both a class doc-comment, and an `__init__` method doc-comment, means both are stitched together in HTML docs (https://radimrehurek.com/gensim/models/doc2vec.html#gensim.models.doc2vec.Doc2Vec), **and** the parameter-details that every user needs to consult wind up **below** the confusing mess of internal-attributes that hardly anyone cares about. Google's Python doc-comment conventions suggest that a class and its parameters can be documented either under the class declaration, **or** under the `__init__` method, but not split between both. (See, eg: <https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html>). Here I've moved the notes about the class under `__init__()`, as that seems to get the most important info – init parameters - to where both code- and doc- readers will most easily find it.
@gojomo
Copy link
Collaborator Author

gojomo commented Sep 23, 2019

Thoughts @piskvorky @mpenkov ?

@piskvorky
Copy link
Owner

Makes sense to me. Are other modules affected? (word2vec, lsi, etc)

@gojomo
Copy link
Collaborator Author

gojomo commented Sep 23, 2019

I've noticed Word2Vec could benefit from the same moving-up of parameters (above internal attributes). Haven't looked everywhere, but if "either class comment or init but not both" becomes project-style, someone could do a full pass-over.

@mpenkov
Copy link
Collaborator

mpenkov commented Sep 28, 2019

+1 this makes sense to me

@gojomo
Copy link
Collaborator Author

gojomo commented Dec 14, 2019

Superceded by #2698 & 7cf2853.

@gojomo gojomo closed this Dec 14, 2019
@gojomo gojomo deleted the Doc2Vec-init-docccomment-only branch January 31, 2020 18:47
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

Successfully merging this pull request may close these issues.

3 participants