Python objects

John Hunter jdhunter at nitace.bsd.uchicago.edu
Fri Jun 28 18:08:24 CEST 2002


>>>>> "Teja" == Teja Sastry <kurugant at denshi.ece.utk.edu> writes:

    Teja> Could anybody share their experience on how to call the C++
    Teja> variable to python, I'm not quite familiar with python . I
    Teja> see there is a way to declare that as a python object in C++
    Teja> program and export it to python. I would really appreciate
    Teja> if anybody can clarify me on how do this prgramming.

This is called 'Extending Python' and there is a helpful manual
written by  Guido van Rossum and Fred Drake:
http://www.python.org/doc/current/ext/ext.html.

There are tools to automate this process.  The boost python library is
probably the best; it's template based C++ library which has extensive
support for wrapping C++ classes in python
http://www.boost.org/libs/python/doc/.  You may also want to look at
SWIG http://www.swig.org, which will generate python extensions for
C/C++ code but has limited support for some C++ features.

There are more ....

Have fun,
John Hunter



More information about the Python-list mailing list