5. The comments¶
Comments are texts that help explain how a program works. The Python interpreter ignores comments, they only serve to help the programmer, but have no functionality.
In Python, comments begin with the #
character:
>>> 5 # Esto es un número entero. Este comentario se ignora.
5
>>> # Esto es un comentario. El intérprete lo ignora.
>>>
We must try to make the code explain itself, thanks to the explanatory names and thanks to a good organization of the code. Comments should only be used in exceptional cases, when it is necessary to add some explanation to the code that cannot be done otherwise.