[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SEUL: Info about Python



On Thu, 31 Jul 1997, Paul Anderson wrote:

> > Python's speed might be an issue for some folks, but it isn't for most
> > -- its dynamicity results in some overhead, which is rarely an issue. 
> > It is easy to take out the bottlenecks using extensions in C.  The
> > algorithms at the core of Python are optimized to work fast in realistic
> > conditions.
> > 
> Interesting...  What's involved in interfacing C with python?  TTYL!

That's a big question.  It depends what you need to do.  Python is written
in C (the reason for its portability), and there is a well-developed (and
documented!) mechanism for adding "modules" to Python which define
functions, classes, types, etc. in C.  This mechanism is used by tools
like SWIG to automatically (or almost automatically) provide interfaces
between C libraries and Python (by slurping and munging the .h files).
That's how I've wrapped a fair bit of the SVGAlib library, thus allowing
me to use all (or most) of the SVGAlib calls from Python.  Or you can
write the extension modules from scratch, and either interface to existing
libraries (the way Python interfaces with Tk) or write self-contained
modules (e.g. the Numeric extension to Python).

Then there's the fact that Python can be embedded in an existing program,
so it can provide a scripting language to manipulate objects handled by
that program.  

These two can happen in the same program (and often do), so that a C
program will embed Python and provide extension modules to Python which
extend Python in some way or other. 

Cheers,

--david

PS: I've kept the cc: to the seul-project list because you did.  I don't
    know how many folks ont that list are interested in this.  I did not
    subscribe, btw.

----------------------------------------------------------------------------
Simple End User Linux Mailing list
To be removed from this mailing list send a message to majordomo@txcc.net
with the line
unsubscribe seul-project
in the body of the letter.
----------------------------------------------------------------------------