PEP 8
noun
say it: “PEP AYT” /ˈpɛp ˈeɪt/
Python's official style guide for how code should look, such as 4-space indents, snake_case names and spaces around =.
What is PEP 8?
PEP 8 is the official style guide for Python code: 4-space indents, snake_case names, spaces around =, and so on. Following it makes your code look like everyone else's.
# PEP 8 style
def total_price(items):
return sum(items)
# not PEP 8
def TotalPrice( items ):
return sum( items )
In a sentence
- “Ruff flagged TotalPrice because PEP 8 names functions in snake_case.”
- “Following PEP 8 makes your code look like the rest of the Python world's.”
Level: Journeyman · More Python terms at this level
Updated