> Programming Languages > Python
Various Topics Home | Disclaimer | Report Adult Posts

Various Topics on Python



Python - "Declaring self in PyObject_CallMethod" in Programming Languages


Old 05-09-2005   #1
..mthier.. ..ail.c..
 
Default Declaring self in PyObject_CallMethod

Calling a python method from C++ has the following signature:

PyObject *
PyObject_CallMethod(PyObject *self, char *method_name,
char *arg_format, ...);

I'm having trouble figuring out how to declare self.

Let's say my python file is called stuff.py and is like the following,
doMath() is defined in stuff.py and is not part of any cl***:

#stuff.py

def doMath():
val = val + 1


In C++, I think my codes should be like the following:

PyObject *resultObj = PyObject_CallMethod( self, "doMath", "");

What do I put for self? Any help please?

 

Thread Tools
Display Modes





Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0