Remember PEP 8

12 Sep 2021 / Oscar F
python zen play logo whit blue-background

How to remember PEP 8, the style guide for python code, with a song by lemonsaur.

Pep 8


Whit help from the lyrics of the song I made a short TL;DR.

Tabs or Spaces?

4 spaces.


Avoid wildcard imports.

Whitespace in expressions and statements

Basically write compact code.

When to Use Trailing Commas

Trailing commas go behind list items.


Correct comments are important.

Naming Conventions

Constants should be named all capital letters and camelCase is not for Python

Programming Recommendations

Never use a bare exception.


A Foolish Consistency is the Hobgoblin of Little Minds

As PEP 20 says, "Readability counts".

The PEP8 Song

I think this song can help you remember Pep 8.

The lyrics to the song can be found below the video on Youtube.

A songification of that most holiest of Python Enhancement Proposals, the PEP 8.
Based on an idea by Daniel "Mr. Hemlock" Brown.
Written and performed by Leon Sandøy, A.K.A. lemonsaurus.
Music and melody from Mad World by Roland Orzabal.
This version was inspired by the version released by Gary Jules.
🌎 Website:​