Help me interpret PEP-257 which says "The class constructor should be documented in the docstring for its __init__ method. "
Does this mean that the constructor parameters should be documented in the class docstring or just the opposite?
Help me interpret PEP-257 which says "The class constructor should be documented in the docstring for its __init__ method. "
Does this mean that the constructor parameters should be documented in the class docstring or just the opposite?
@fohrloop Hi - As quoted from the top of the PEP-257,
"All modules should normally have docstrings, and all functions and classes exported by a module should also have docstrings. Public methods (including the __init__ constructor) should also have docstrings."
For me, you should document the parameters of the constructor in the __init__(self, ...) body.
That's what I can see used in most python packages I see...
@frague59 And when I was documenting the constructor parameters in the __init__ method, the docs Sphinx creates (1) look repetitive (2) Have parameter explanations quite far away from the class definition: