Code is for computer, comments are for humans.
Do you agree with this statement?
Use whitespace and newlines strategically.
if foo == 'blah': do_blah_thing() do_one(); do_two(); do_three()
with
if foo == 'blah': do_blah_thing() do_one() do_two() do_three()
Compound statements are generally discouraged, make generous use of newlines
use descriptive names for functions and variables
Compare
for i in my_shopping_basket: if(test(i)) > 10: purch(i) else: disc(i)
for item in basket: if(testNecessity(item)) > 10: purchase(item) else: discard(item)
use a consistent style
Compare:
myVar = original_variable + MOD(new.var)
my_var = original_var + Modified(new_var)
consistency is key!
Don’t do this
x = x + 1 # Increment x
This is more useful
x = x + 1 # Compensate for border