This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 10: Commenting

Style guide for comments

face Josiah Wang

Python offers a style guide even for writing comments.

You can find this in the “Comments” section of the official PEP 8 Style Guide for Python Code

Please take a quick look at the “Comments” section of the document (it is quite short), and consider their points.

For this course:

  1. You should always include comments in your code (penalty to your coursework assignments if you do not leave any comments at all!)
  2. You should leave at least one space after a #.
  3. Your comments must be readable.
  4. Your comments should be meaningful and informative, and not just stating the obvious (see previous page).

Otherwise, we will not be enforcing any further style guidelines as described in the official guide (although we do encourage you to consider them).