Learning Python the quick way

Tim Chase python.list at tim.thechases.com
Sat Apr 25 03:42:43 CEST 2009

> I am not sure what will happen if I do the programing in 
> python the find the program doesn't deliver the desired 
> performance due to lack of a good compiler.

I've rarely found this to be a problem unless you're doing 
CPU-intensive work.  However, the usual workflow involves:

1) code it in Python

2) if it's slow, profile it and check your algorithm(s), recoding 
if you're using some algorithm with a bad big-oh profile

3a) if it's still slow, try using Psyco, Shed-Skin, or their ilk 
to compile your code down a bit

3b) if it's still slow, profile again and try using specialized 
libraries (numpy/numeric, opengl libraries, cStringIO, etc) for 
those bottleneck points

4a) if it's *still* slow, profile it *yet again* and create an 
optimized C/C++ module, using that from within your Python

4b) examine your code to see if multiprocessing would help divide 
up the CPU intensive tasks

I've never had to go much past step #2.  I good choice of 
algorithm in Python can beat the pants off a bad choice of 
algorithm in C/C++.

However the first rule:  profile first!

> So I wanted to learn more about the projects that people are 
> working on using Python to get the feel of the languages 
> application.

I do a lot of ETL (Extract/Transform/Load) scripts, some web 
development, various automation tools, a little game-development 
stuff, and a few command-line apps.


More information about the Python-list mailing list