A Python style guide

The Python style guide was written with the understanding that code is read more often than it is written

Indentation

  • Four spaces per indentation
  • Check your code workspace is configured to set the TAB key to convert to 4 spaces

Line length

  • Each line of code should be less than 80 characters
  • Each line of comments should be less than 72 characters

Blank lines

  • Group code into relevant blocks using blank lines

References

PEP 8 – Style Guide for Python Code

Last modified July 21, 2024: update (e2ae86c)