Python newbie

Aahz Maruch aahz at netcom.com
Sun Dec 26 19:46:38 EST 1999


In article <000d01bf4ff5$e33d7220$5c2a4b0c at amd>,
John Ratcliff <jratcliff at worldnet.att.net> wrote:
>
>Thanks for all of the informative messages.  It certainly sounds like Python
>may be the language I want to use.  A few more quick questions.  Is there a
>C++ implementation of Python?  I really prefer *not* to put a large
>collection of C code into my C++ application if I can avoid it.

You don't put any C code into your application; you link to a library
that happens to be written in C but could be written in FORTRAN for all
you know.  ;-)

I haven't actually done any work in this area, but I seem to be the only
one posting...

With regard to Python extensions, you have two options.  One is to
directly call a library that can be written in any language (see SWIG
for help here); the other is to use Pythonic C.

>Are there Python variants that might be better suited, like this Viper
>language I heard mentioned on the list?

Viper is written in a langauge called Ocaml and is not yet ready for
prime time.  JPython is another alternative (Python written in Java).
Given that your application core is already being written in C++, I'd
suggest sticking to CPython.

>If Python is a dynamically typed language, how does it handle sending
>specific types to a native function call or from a native call into Python?

As I alluded to above, you can either force Python to send binary types
across the interface or you can use Pythonic C to use Python types (or
use JPython and Java types).  I assume you can also use a combination of
the two, though I have no idea why you'd want to (within a single
library, I mean, you might purchase a library that you want to interface
to Python).

Just to be clear, you can embed a Python interpreter in your
application, make calls from Python into external libraries, or both
(you could even have an embedded Python interpreter make callbacks into
your application, though I hear that gets a bit tricky).

One of Python's strengths is that it is a very good glue language.  For
more reassurance, take a look at http://www.python.org/psa/Users.html
--
                      --- Aahz (@netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

TEOTWAWKI -- 6 days and counting!



More information about the Python-list mailing list