[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Game idea revised



Greg Ewing wrote:
> Charles Joseph Christie II wrote:
> 
>> Didn't know you could use C extensions in Python. Is that like saying,
>> if I have a library I like to use in C .. I can use it in python?
> 
> It's probably not something that a beginning Python user
> should attempt.

I disagree; when I played with SWIG it was pretty easy to do, and I
had very little experience with Python. The concepts involved were a
little tricky, but in my opinion that would have been the case no
matter how experienced with Python the programmer was.

The important insight is: Python is implemented in C using an API
called the Python C API. This API can be used to embed Python, ie.
wrap the interpreter in another program, or to extend Python, ie. wrap
other C code in a Python-friendly way. Either way requires familiarity
with the C API, but SWIG can generate wrappers for C functions for you.

Ethan

Attachment: signature.asc
Description: OpenPGP digital signature