The MouseTrap?'s Coding Standards are used in every script, module, adaptation, patch that have been written, and have to be used in futures developments.

Functions Declaration

The functions declaration have to be written like this, remembering the spaces between the parenthesis.

1) The names have to be written with the first word in lower case and the others capitalized.

2) The private functions have to have a underscore at the beginning of the name.

3) The parameters have to be declared letting spaces between the variables, the equals and their values in case they have one.

def _newPrivateFunction( ):
     action

def newNormalFunction ( param1, param2 = False ):
    action

Variables Declaration

The variables have to be declared like this.

1) The names have to be declared like the functions, the first word in lower case and the others capitalized.

var1         = "Value"
_newPrivate  = "Private"

Comments

All classes,functions and common variables have to be commented using the python way

def function( param ):
    """
    This is a function that executes some code

    Arguments:
    - param: This param is the value to return

    Returns The value of param
    """
    return param

Dictionaries and Lists

If a dictionary or List is being declared it has to be done like this:

dictio = { key1 : "Value",
           key2 : "Value2",
           key3 : "Value3" }

listEg = [ "value",
           "value2",
           "value3" ]