...

/

Documentation: Code Comments

Documentation: Code Comments

Learn what it means to document code in Python, especially through code comments.

We'll cover the following...

This lesson is about documenting code in Python from within the code. Good code is self-explanatory but is also well-documented. It is a good idea to explain what it is supposed to do (not how).

One important distinction that should be made is that documenting code is not the same as adding comments to it. Let's briefly touch on the subject of code comments, just to establish some points that will make a clearer distinction between the two.

Code documentation is important in Python because, since it's dynamically typed, it can be easy to get lost in the values of variables or objects across functions and methods. For this reason, stating this information will ...