[C++-sig] exposing pointer to Python

Alexey Akimov alexey.akimov85 at gmail.com
Tue Jul 7 01:07:54 CEST 2009


I have some class X that contains a variable which is a pointer to some
other class OtherClass (for simplicity we may imagine it can be some
standard c++ type - int, double, etc.):

class X{

public:
     OtherClass* variable;

};

my question is: how can I expose it to python such that user may access to
variable using [] operator?
like:

>>> import module
>>> module.X[i] = i

I've found several examples on this topic:
http://mail.python.org/pipermail/cplusplus-sig/2005-January/008189.html
http://osdir.com/ml/python.c++/2003-01/msg00042.html

but still can not make this trick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20090706/a8847f35/attachment.htm>


More information about the Cplusplus-sig mailing list