Sorry for making you loose your mind :p
Now, to a more technical question that raised itself when I started looking into this:
Cython or SWIG?
They are different things afaik, but I haven't followed this area.
The "core" way of doing things is using the C-Python API, as described in the "extending" document. If you write some code in that API, you'll notice there are loads of patterns in the code. And thus there are code generators, such as SWIG, that aim to reduce the amount of work.
(Now that you mention SWIG, you might want to have a look at the Micropolis project at googlecode, which uses SWIG.)
So far so good. This is all fine, but you still have to write C or C++ code for the "fast" functions. What if you don't want to do that (or don't know C/C++)? That's what Cython aimed to fix afaik. You can write Python, and add C-ish code. Cython compiles that blend into an executable. It gives you much more fine-grained control of what is Python and what is C than a single function.
It is however in my view not glueing C/C++ code to Python, it is writing faster Python code.
(But as I said, this was about 10 years ago, when Cython just appeared, and was all beta and experimental. The landscape may have changed dramatically in those years.)
I'll assume asking "which is better" won't get me anyway. But which do you personally prefer, and why? Which one would be more friendly to someone new to the bindings concept? Other things I should know before making the choice?
I don't believe there is a "best", unlike what vendors are trying to make you believe. The open source eco system generally has 5+ solutions to every problem, and they all serve a market where their solution excels.
The applications that I generally write are code generators, which are typically small but complicated. Together with my desire to have full control over what happens in my code, the solution for me is the official C-Python API. I'll take the patterns, or write a code generator to eliminate them :p
On the other hand, when confronted with SWIG in Micropolis, I had some trouble convincing it to work, but it generally did its job. If your interface is big (and it will be), SWIG may be a lot simpler in the end. (If you're like me, and you want to understand the code generated by SWIG, I'd recommend at least playing with the official API for a bit. It'll give you a good idea of what SWIG is actually solving.)
I don't know about Cython. I played with it one time. It is on my list of things to consider for "really fast Python code", based on information that is 10 years old. However, with the speed of current machines, and me moving in a different direction, it's unlikely I'll ever end up with Cython in the near future.EDIT:
While re-reading my answer, you should check that Cython can handle pure Python code. If you want to allow user-contributed scripts, but Cython requires re-compilation to add that code into the system, you might have a problem.
My project: Messing about in FreeRCT
, dev blog
, and IRC #freerct at oftc.net