Python as an embedded extension language
Raphaël Berbain
raphael.berbain at bigfoot.com
Tue Jul 2 09:31:56 EDT 2002
Hi,
I am quite new to the python language (a couple of days, really). So
please be nice, I can commit huge mistakes quite easily. I came
across it because I am looking for an extension language for a
C++-based application I am writing. Here are the points that caught
my eyes :
- Python is simple and readable (If I understand correctly, these are
design goals).
- Functions are first class objects.
- Interfaces well with C++ (thinking of using the Boost python lib) -
I found a lot a languages that interface with C, but much less with
C++.
- Well documented.
- Large and active community.
Now before I invest any further into Python I have a couple of
questions :
- Licensing issues: Python license (2.2.1) seems to be quite
permissive. From what I read, it seems I can do pretty much
anything with Python, as long as I leave copyright notices and
explain my modifications. For the moment, I am thinking of some
kind of BSD-type license for my own code. Would this be working
together ? (see below for how I plan to use Python in more details).
- I'd like to embed Python in my app statically, maybe with some
modifications. Primary goals are that it only includes needed
features and that it doesn't interfere or depend on a user random
Python installation. Is that doable ? I mean, pruning the python
base install to the strict minimum and completely isolate my app
from any existing python installation on the system ?
- Would this kind of manipulation enlarge by any significant amount
the embedding app size and/or memory footprint ? Incidentally,
what is the garbage collecting scheme used by Python ? More
generally, is there any studies about Python memory usage ?
- I read here and there that Python is really slow. That's ok with
me, I am not a speed freak (especially given that if I need speed,
there's always the C++ side of the app). Does anyone have relevant
figures about Python speed ?
- I also read that Python can vary a lot between versions. What is
people experience with this ? This might not be an actual problem
in this case, since I intend to include Python statically in the
app, so I can always stay with a version that works instead of
being forced to support the last version. Still, it would be nice
to know.
- Is there a way to enter the debugger when some run-time error is
encountered (a bit like the Emacs elisp debugger, when
debug-on-error is t). This may not be needed, since for the moment
I foresee a much more closed system than the Emacs' one, but this
would still be convenient.
More generally, I would be interested in hearing people's experience
with embedding Python, especially with C++ (Boost python lib
impressions wlecome).
Thanks for your attention.
--
Raphaël
More information about the Python-list
mailing list