Accessing class members from C

disgracelands disgracelands at quietblue.co.uk
Mon Sep 1 09:08:37 CEST 2003


I'm starting to develop an application in Python running the interpreter
from C, i've got callbacks and stuff setup (was pretty pleased with that)
and i'm starting to get my head around the reference counting but i've hit a
snag.  I'm creating objects within python then linking them to their C
counterparts, what i want to do now is directly access the python class
variable objects from C.  Basically i have the python class object as a C
pointer and i want to access one of the class members, somevar, and even
read access would be fine.  I'm guessing theres a really easy way to do this
but i can't find an example in any of the docs and google turns up pages of
unrelated problems.

I know that i could write Get() and Set() methods for each member variable
but it doesn't seem like a very nice solution.

Cheers for any help







More information about the Python-list mailing list