Changes between Version 16 and Version 17 of coding_rules


Ignore:
Timestamp:
08/06/20 15:36:41 (5 years ago)
Author:
jdquinn
Comment:

Added documentation for Python doctrings

Legend:

Unmodified
Added
Removed
Modified
  • coding_rules

    v16 v17  
    5757bool Test(int a,double b,char* c){
    5858}}}
    59 == Matlab ==
     59== MATLAB ==
    6060
    61 - All matlab routines should start with a help (Example and See Also are not mandatory):
     61- All MATLAB routines should start with a help (Example and See Also are not mandatory):
    6262{{{
    63 #!m
     63#!matlab
    6464function outputs=FunctionName(inputs)
    6565%FUNCTIONNAME - one line description
     
    8181
    8282{{{
    83 #!m
     83#!matlab
    8484function outputs=hello()
    8585%HELLO - prints hello to the screen
     
    102102flake8  --ignore=E262,E265,F403,F405,E405,E501
    103103}}}
     104
     105=== Docstrings ===
     106Adhering to [https://www.python.org/dev/peps/pep-0257/ PEP8 Docstring Conventions] while attempting to mirror the conventions we follow under MATLAB, modules, functions, classes, and method definitions should be documented according to the following protocol,
     107
     108{{{
     109#!python
     110def FunctionName(inputs):
     111    """FUNCTIONNAME - one line description
     112
     113    Extensive description of what is being done, inputs
     114    outputs, etc...
     115
     116    Usage:
     117        outputs = FunctionName(inputs)
     118
     119    Example:
     120        md.test = FunctionName(1)
     121
     122    See Also:
     123        FunctionName2, FunctionName3, ...
     124    """
     125}}}
     126
     127As with MATLAB, at the very least, the first line and the 'Usage' should be provided. Unlike MATLAB, use indentations of 4 and 8 spaces.
    104128
    105129=== MATLAB Built-In Equivalents ===