Right Way to Write Comments
Comments serve the main purpose to explain your code. Developers use healthy comment writing practice for better understanding of the code.
Some of the tips you can follow, to make your comments effective are:
- Comments should be short and precise.
- Use comments only when necessary, don’t clutter your code with comments.
- Comment should have some meaning.
- Avoid writing generic or basic comments.
- Write comments that are self explanatory.
We have discussed all about Python comments, how to write Python comments, types of comment,what are it’s advantages and the right way to write comments.
Also Read: How to write Comments in Python3?
Python Comments: Importance, Types and Correct Way to Use
Comments in Python are the lines in the code that are ignored by the interpreter during the execution of the program.
# I am single line comment """ Multi-line comment used print("Python Comments") """ |
Comments enhance the readability of the code and help the programmers to understand the code very carefully. It also helps in collaborating with other developers as adding comments makes it easier to explain the code.