> > ctypes is essential. You might want to write a plugin in Python, and > find that the cost of converting data from C++ to Python and vice- > versa is acceptable (it isn't, always,) but the algorithm you want to > use is very expensive in CPython. ctypes lets you write bits of that > algorithm in C and easily call the C from Python.
this is getting a bit off topic, but if you're into ctypes, you should check out cython. it's a python-like language that allows you to write hybrid python and c code. it can be used for about any conceivable purpose where python and c need to interact: c/c++ python bindings, fast compiled modules, exposing python libraries to c, even statically typing pure python code for speed. pretty slick and very easy to write. to use c code within it, you must create special header files, as it cannot read c headers directly. this is a bit of a pain, but if anyone is interested in it, i can post what little i have so far for maya and people can add to it as they need it. to give you an idea of what is possible with it, i'm using it to create python bindings to a c++ library which uses both the maya C++ API and arnold's C API. it gets really tricky because maya has its own bindings using swig, and arnold has its own using ctypes, which my bindings must be able to play nice with. so cython is the perfect common ground where i can write relatively simple code to convert back and forth between all these APIs and their various bindings. -chad -- http://groups.google.com/group/python_inside_maya
