SWIG, F2PY, and Boost.Python. These tools let you wrap C/C++, Fortran, and C++ code, respectively. Although you
could write your own wrapper code for accessing your extension modules, using a tool like one of these takes a lot of
the tedium out of the job—and makes it more likely that the result will be correct. For example, when using SWIG,
you run a command-line tool on your C (or C++) header files, and wrapper code is generated. A bonus to using SWIG
Appendix A
■
pedAl to the MetAl: AccelerAting python
257
is that it can generate wrappers for a lot of other languages, beside Python, so your extension could be available for
Java or PHP as well, for example.