[C++-sig] pyplusplus tutorials & GUI wizard

Matthias Baas baas at ira.uka.de
Thu Feb 9 17:39:11 CET 2006

Roman Yakovenko wrote:
> First of all the bug has been fixed. You can check out only pygccxml package.

Thanks, this has led to another bunch of classes being wrapped 

>> And then, for some reason, pyplusplus doesn't see the correct name ("v")
>> of the argument and just calls it "arg0" in the bindings.
> There is nothing I can do. GCC-XML does not report argument name :-(.
> I have to find time and to submit few bugs to GCC-XML.

But the argument names are correct in my original code and do appear in 
the generated bindings...? Do you know under what circumstances gccxml 
drops the argument names?

Meanwhile I have a few cases where I need to reject some particular 
class methods. For example, I have a class with methods of the following 

class Foo
   float& spam(int i);
   float  spam(int i) const;

The spam() method returns a float value that is stored inside the class. 
For the Python bindings I'd like to ignore the first version that 
returns the reference. What is the recommended way to do this?
Is there a convenience function that can easily check if a declaration 
actually represents a method "float& Foo::spam(int)" or do I really have 
to inspect every little detail myself (i.e. check if the name of the 
declaration matches "spam", check if the parent declaration is a class 
declaration called "Foo", check if it has one single argument of type 
int, check if it has a return type of type float&, etc.)? I found the 
function find_first_declaration() that looked closest to what I want to 
accomplish when used with the 'fullname' argument. But this only takes 
the class and the method name into account, but not the arguments and 
return type.

Then I have two more questions:

- How do you add new methods to a (Python) class? In my case, I want to 
wrap a class whose Python version should have an additional static 
method (which I'd like to implement as a C++ function).

- Is there already a way to specify doc strings?

- Matthias -

More information about the Cplusplus-sig mailing list