Code Commenting - ilabs-kdc/bluesky GitHub Wiki

To make sure that others can understand your code, commenting is important. These can be single lines, by using #, or a block, using '''. When creating a new python file, it is useful to add a file description (see below). When you are creating classes and functions (methods), it is very usefull to include a class / function (method) description (see below). Next to commenting, it is also very useful to give your variables sensible names.

File Description

A file description looks something like this:

'''
(Purpose of the python file)

Created by: ...
Date: ...
'''

Class Description

A class description looks something like this:

'''
Definition: (Purpose of the class)
Methods:
    method_name_1(): (Purpose of method 1)
    method_name_2(): (Purpose of method 2)
    ...

Created by: ...
Date: ...
'''

Function/Method Description

A function/method description looks something like this:

'''
Function: (Purpose of the function/method)
Args:
    arg_1:    (Description of input 1)
    arg_2:    (Description of input 1)
    ...
Returns:
    return_1: (Description of returned item 1)
    return_2: (Description of returned item 2)
    ....

Created by: ...
Date: ...
'''