Python Rules Of Coding: Comments

in Education5 years ago

Previous
Python Rules Of Coding: Naming Conventions

code-1084923_1280.png

Source

Python Rules Of Coding: Comments

Comments :

For In-Code documentation in Python, comments are so essentials. Comments are the extra understanding layer of the code. It should be simple and verbosely so that it can be read and understand easily. Comments start with the '#' (hashtag ) symbol in Python.

Conventions:

  1. Updating the code and keep changing the comments according to that.
  2. Comments should be simple, verbose, and complete sentences.
  3. The way we write a sentence in general comments should be like that.
  4. If a comment is short and one line, we can avoid using the period in the end.
  5. Multi-line comments are called block comments. Every sentence must end in a period.

py1.JPG

Always try to use inline comments, because it is so important to understand the code easily.

py2.JPG

Next

String Quotes, and User Documentation

.............................................