Calling C from Python

Michael Hudson mwh21 at cam.ac.uk
Wed Feb 21 09:08:16 EST 2001


"Rich Somerfield" <rich_somerfield at tertio.com> writes:

> I have written a Game Engine in Python (main allow simulation of
> Board Games using a config file as the definition of the game). The
> problem is, is that the AI section is too slow.  As the code needs
> to be generic (e.g. cant specialise as the game type etc... is
> unknown until runtime - from config file), i have been unable to
> optimise the code further.
> 
> I want to use Python as my main langauge and have certain code
> (where performance is essential) written in C.  I have looked at the
> doc's and cant get a feel for it.  Can anyone point me in the
> direction of some sample code (complete - not segments!), or give me
> a little helping hand?

Have a look at:

http://www-jcsu.jesus.cam.ac.uk/~mwh21/hacks/ext/defining-new-types.html

It's not nearly finished yet, but you might find it helpful.

Cheers,
M.

-- 
  Darned confusing, unless you have that magic ingredient coffee, of
  which I can pay you Tuesday for a couple pounds of extra-special
  grind today.                           -- John Mitchell, 11 Jan 1999



More information about the Python-list mailing list