Skip to content
destan edited this page Jan 10, 2013 · 2 revisions

Comments in Python Classes

We shall adopt following comment style

def area(base, height):                                           # Header
    '''
    (number, number) -> number                                    # Type Contract
    
    Return the area of a triange with dimensions base             # Description
    and height.
    
    >>> area(10, 5)                                               # Examples
    25.0
    >>> area(2.5, 3)
    3.75
    '''
    return base * height / 2                                      # Body

Git commit messages

uses the imperative, present tense: "change", not "changed" or "changes"

More on http://git.kernel.org/?p=git/git.git;a=blob;f=Documentation/SubmittingPatches;h=ece3c77482b3ff006b973f1ed90b708e26556862;hb=HEAD

Clone this wiki locally