Python conventions (Zen of Python but others for other languages)

--Originally published at Quirino´s Projects


#Go ahead try this in your python3/2 console

import this

#Just go to shell enter python3/python2 and paste that

20140709_python_bytes_3-11-1

 

Write easy to read code

 

#Python comes helpful to teach you how to indent your code
#Since it won't run if you don't
#Indent makes it easy to understand nested code
if 1 == 1:
    for i in range(5):
            print ("This is the range of 5")
            for x in range (45):
                if i = 5:
                    print("We are in the range of 5 of the range of 5")
#Of course this is a pretty bad example but i think you get the drill
#With indentation you know what things belongs to where

Useful external sources:

7 ways to write beautiful code