I think you'd need to write a C++ class that has the methods you want to
implement in C++,
then wrap that with SWIG, then inherit from that, though multiple inheritance
if you also need functions from a base Python class.
The PyQt people use SIP I think, instead of SWIG, might be useful to look
[EMAIL PROTECTED] wrote:
Am I misunderstanding the purpose of PyObject* self?
No. I think you do everything right, but it still doesn't work.
I have tried to implement it in Python:
_test.py:
def func2(self, *args):
print type(self)
If you implement _test in C, works none of the above.
The only difference I can see is that:
type(_test.func2)
type 'function'
is for Python implemented function and
type(_test.func2)
type 'builtin_function_or_method'
for C implementation
I would really like to know the answer too.
I am having a problem implementing some methods of a python class in C.
The class is defined in python, but I would like to rewrite some methods
in c. Here is an example of what I want to do:
file _test.c:
#include Python.h
static PyObject *
func2(PyObject *self, PyObject *args)
{
if (self
I honestly don't know the answer to this and I am entirely guessing
but--does it work without using the new module? That is:
import _test
class Foo:
pass
foo = Foo()
foo.bar = _test.func2
foo.bar()
On Thu, 2005-08-18
Nope, it still doesn't work. Anyway, that's not exactly what i want, since
i want func2 to be accessible from all instances of Test()
Naveen
On Thu, 18 Aug 2005, Jeremy Moles wrote:
I honestly don't know the answer to this and I am entirely guessing
but--does it work without using the new
I am having a problem implementing some methods of a python class in C.
The class is defined in python, but I would like to rewrite some methods
in c. Here is an example of what I want to do:
file _test.c:
#include Python.h
static PyObject *
func2(PyObject *self, PyObject *args)
{
if (self