QamoosTech
Programming FundamentalsCode qualityBeginnerPython

PEP 8

PronunciationPEP AYT

Definition

PEP 8 is Python's official style guide. It describes how to name things, indent and format code so Python programs look consistent.

Where you hear it

In Python code reviews, linter and formatter settings, and onboarding documents for new developers.

Examples

  • Please follow PEP 8: four spaces and snake_case names.
  • The linter reports a PEP 8 violation on that line.
  • PEP 8 asks for two blank lines before a top-level class.

Common mistake

Arguing about style by hand in reviews. Let a formatter such as Ruff or Black enforce it automatically.

Don't confuse with

A linter, which finds likely bugs. PEP 8 is only the style agreement the tools check.

Say it at work

  • In a meeting or chatRun the formatter so we don't discuss PEP 8 in the review.
  • In an email or ticketThe CI fails on style, so fix the PEP 8 warnings first.