Chapter 9: The PEP 8 style guide

Line length

face Josiah Wang

PEP 8 recommends that each line in your code should be limited to 79 characters. This just makes your code more readable. Your text editor should usually show you the number of columns in your current line.

I recommend and encourage following this guideline, but will not be strictly enforcing this for this course (I do not have the energy or the time to count the number of characters for every line!) But our team will start reprimanding you for code readability if your line is obviously too long (100 characters might be excessive)!

If your line of code is getting too long, consider rewriting it to make it more readable. A bit like breaking up a very very very very long long long sentence into several short sentences.

But sometimes long expressions and statements are unavoidable. So how do we break these up across lines?