Python scripting - Introduction

Python Code Style Guide

Previous  Chapter  Next

 

   

Style Guide for Python Code

 

Style guidelines are intended to improve the readability of code and make it consistent across the wide spectrum of Python code. The PEP 8 – Style Guide for Python Code: https://peps.python.org/pep-0008/ is the most widely used style guide at the moment.

 

FASTSUITE code primarily uses the CapitalizedWords (or CapWords, or CamelCase) naming style, so it is recommended to follow this style in all customer projects.

 

 

General CENIT style recommendations


Class and Function names

Class and Function names should normally use the CapWords convention, for example, MyFirstClass or MyFirstFunction.

 

 

Variable names

Local variables: localVariable

Global variables inside one module: GlobalVariable

Constants: CONSTANT_VARIABLE

Private variables: _semiPrivate and __superPrivate

 


Comments and descriptions

Please use autoDocstring extension (see Recommended VS Code extensions).

Classes and functions should be documented with triple quotes, for example """Description"""

Hashtags should be used only for inline code comments: # Comment


Code sample

Please see one of the cenpylib classes as an example.



Previous
Previous page
Chapter
Chapter page
Next
Next page