6. xrange instead of range
C version of range, designed to work with int
TIP4
7. map is a wonderful idea,
so is reduce and filter
map(function, data)
TIP5
8. Function calls are costly
●
pass entire list to a function than iterating on each
element and calling the function
●
Recursive loops are dangerous with quadratic
complexity
TIP6
9. Local variables are faster
they are faster than global variables, builtins and
attribute lookups
TIP7
10. delete the unnecessary
●
use proper namespacing
●
weakref is a good idea
●
use gc.collect() to expicitly collect the unused variables
TIP8
11. Threads for I/O
ctypes for CPU(GIL)
●
use threads for I/O bound processes.
●
For CPU bound with GIL lock, use gevent or C
extensions to override it
TIP9