DEV Community

Discussion on: You should write a comment on every line of code

Collapse
 
waylonwalker profile image
Waylon Walker

This is why I like python.

  1. Typically when I have a line that I need to comment on, I find that refactoring is necessary, then it almost reads as pseudo-code, and doesn't need a comment that needs to be updated with the code.

  2. It also has a very good practice of making good clear docstrings that find there way into the documentation, and help text. This is where you tell users of your code how to use it, what it does (high level), and why. It does not need to be fully detailed, your code should be the details. realistically many libraries have more docs than they do code. especially when you add up all of the examples. But they do not document each line x=10 # setting x to 10

Some comments have been hidden by the post's author - find out more