wrapping c code for python using swig on Mac OS X

in from john d cook
http://www.johndcook.com/blog/2009/01/20/using-swig-to-expose-c-code-to-python/

from
http://www.penzilla.net/tutorials/python/swig/

and combining the two I came up with a way to get this to work on Mac OS X

bash$ cat erf.i

%module erf
#include
double erf(double);

bash$ swig -o erf_wrap.c -python erf.i
bash$ gcc -o erf_wrap.os -c -fPIC -I/usr/include/python2.4 erf_wrap.c
bash$ gcc -o _erf.so -shared erf_wrap.os
bash$ python
>>> from erf import erf
>>> erf(1)
0.84270079294971489