Need help on Python/C++

Donn Cave donn at oz.net
Wed Jun 7 00:47:07 EDT 2000


Quoth "Sameh chafik pro" <chafik at nevrax.com>:
| That  is okay, but why i do to translate a class write in C++. The
| problem that the standard way is to use the PyTypeObject and define the
| constructor as a function, but python don't recognize the translation as
| class but as type object.morality if i do the translation of a class "X" it
| is'nt posible in python to use it as a derivate class:
| class A(X):
|     def doSomething(self):
|     .....
|     ....
|
| is not possible. Because X is a function.That seem insignificant but i want
| to do an efficient translation between C++ code and Python.

I'll go along with Ken Seehof's response in another thread, where
you posted what appears to be more or less this same question.

What you need is a Python class, written in Python, that binds itself
to the internal type instance that you wrote in C++.  This binding
can support both the C++ functions, invoked from Python, and Python
functions invoked from C++ virtual functions.

I do this for the BeOS API, which is C++.  I got most of the important
ideas from a Jim Ahlstrom paper some time back,

http://www.python.org/workshops/1995-12/papers/

	Donn Cave, donn at oz.net



More information about the Python-list mailing list