In my case, these are the two points where I find it is better not to follow PEP8 rules:
First case:
The rule for "79 characters per line" is totally absurd. Kindly check how unreadable code becomes when doing this:
class Rectangle(Blob):
def __init__(self, width, height,
color='black', emphasis=None, highlight=0):
if width == 0 and height == 0 and \
color == 'red' and emphasis == 'strong' or \
highlight > 100:
raise ValueError("sorry, you lose")
if width == 0 and height == 0 and (color == 'red' or
emphasis is None):
raise ValueError("I don't think so -- values are %s, %s" %
(width, height))
Blob.__init__(self, width, height,
color, emphasis, highlight)
2nd Case:
- Imports should usually be on separate lines, e.g.:
Yes: import os
import sys
No: import sys, os
I always write simple imports together. I don't see any benefit to addressing them all on separate lines: all it does is add new lines from the top of each source file and turn something compact and easy to complex code. This is instantly readable and understandable:
import sys, os, time, gc, inspect, math, doctest
Join this Python Training course now if you want to gain more knowledge in Python.