RidgeRun Developer Manual/Coding Styles/Python: Difference between revisions
Efernandez (talk | contribs) |
Efernandez (talk | contribs) |
||
Line 17: | Line 17: | ||
== Code Layout == | == Code Layout == | ||
=== Indentation === | |||
Use 4 spaces per indentation level. See [https://www.python.org/dev/peps/pep-0008/#indentation indentation] for more information. | |||
=== Maximum line length === | |||
Limit all lines to a maximum of 79 characters. See [https://www.python.org/dev/peps/pep-0008/#maximum-line-length maximum line length] for more information. | |||
=== Imports === | |||
*Imports should usually be on separate lines | |||
<syntaxhighlight lang="python"> | |||
# Correct: | |||
import os | |||
import sys | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="python"> | |||
# Wrong: | |||
import sys, os | |||
</syntaxhighlight> | |||
== Naming == | == Naming == |
Revision as of 21:00, 21 June 2021
WORK IN PROGRESS. Please Contact RidgeRun OR email to support@ridgerun.com if you have any questions. |
RidgeRun Developer Manual |
---|
Coding Styles |
Development Tools |
Editors |
Debugging Tools |
|
Profiling Tools |
Methodologies |
Design Patterns |
RidgeRun Developer Manual/Testing |
RidgeRun Developer Manual/Build Systems |
Contact Us |
Introduction to 'Python' Coding Styles
When writing Python code, RidgeRun tries to follow PEP8 - Style Guide for Python Code. Following we present some of the rules presented in this standard. For more information please visit PEP8.
Good practices
Be consistent with your code
In general, if you are adding code to an existent code, be consistent with the coding standard already being used. If no standard is used then follow this guide.
Code Layout
Indentation
Use 4 spaces per indentation level. See indentation for more information.
Maximum line length
Limit all lines to a maximum of 79 characters. See maximum line length for more information.
Imports
- Imports should usually be on separate lines
# Correct: import os import sys
# Wrong: import sys, os
Naming