python/c++/swig: some more problems.

Bo Peng bpeng at rice.edu
Sun Jun 13 20:53:03 EDT 2004


Dear list,

With the help from this list, I have experimented some techniques and I 
have to say python/c++/swig is wonderful! I still have some questions 
though:

1. Is there a way to access int * member of an object from a pointer 
returned by Python?
   >>> a.internalIndex
   '_88401708_p_int'
I have used vector<int> etc (in C++ code) and vector.i (swig) to pass 
python list to C++ like 'foo([1,2,3])' but I do not want to use vectors 
everywhere due to performance considerations.

2. The shadow class has definitions like __init__(self, *args) so I can 
not use keyward arguments like a(x=1,y=2). Is there an option in SWIG to 
enable this? If I have to, how can I modify the interface file to enable 
this?

Many thanks in advance.
Bo



More information about the Python-list mailing list