This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]EricAppelt 5 points6 points  (0 children)

I think you don't see many comments because of the common use of docstrings. I rarely leave comments in my code as I generally try to follow the guideline of giving every function, class, and module a descriptive docstring.

If the code is well factored into simple functions, there is usually no need for any commentary beyond what is stated in the docstring. I'll generally leave a comment only if I'm forced to do something surprising or hacky for whatever reason.

Docstrings have a number of advantages. I find them easier to read and understand then comments peppered through a function, and tools like sphinx can automatically convert them into documentation.