Extending/embedding versus separation

skoria shomon at softhome.net
Wed Mar 27 13:20:41 EST 2002


Hi

I have a system for processing usage statistics, for which most of the
hard work is done by a small C program which is very good at quickly
and with low memory usage, parsing logfiles, and putting the results
in hash tables.

Now I want to create fancy graphs, cross process the information
gathered, work on presentation, make trends and things easy to spot.
In short, I want to concentrate on other things than moving memory and
pointers around. So the plan was until today to write everything out
to a text file and process these files with python to display in html
or whatever other format comes to mind. 

But I've been reminded that python is good at integrating with C
programs through extension and embedding. This tells me that the other
way to go from here is to turn my c program into a python extension,
or somehow merge the two languages, so that I miss the step of saving
the C programs results to disk. (and potentially increase memory
usage?). I will be having a look at "programming python" tonight, to
see which, out of extending and embedding, is what I should go for.

Are there any other advantages to using this method, which apart from
sounding cool, might offer something I've not thought of? If it's just
"cool", then I'll skip it and just go the easy way, of keeping python
and C separate, and saving the hash tables to disk. But I'd love
people's imput, as this is an important stage in my little baby
program's life... :)

Thanks very much in advance,

Ale





More information about the Python-list mailing list