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

Matthias Baas baas at ira.uka.de
Wed Feb 8 23:54:46 CET 2006


Roman Yakovenko wrote:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive should be set to False

Hm, with my first attempt of using pyplusplus I only got empty source 
files unless I set recursive to True (see the beginning of this thread), 
but when I test it again now, it actually works....?
Anyway, it's a bit odd that an apparently "unrelated" option changes the 
semantics of the filter function. Why is the filter then called on 
objects such as class methods where the return value of the filter has 
no effect at all? It would be a little less confusing if the filter 
wouldn't be called at all in those cases.
It's the same with classes that were already rejected by a filter call, 
I noticed that in this case the filter is still invoked on the methods 
of the already rejected class which also has no effect and could be 
entirely left out.

> Now I understand why you have been confused.
> 
> 1. Lack of documentation.

Definitely! ;)


Thanks to the tip with the recursive flag I could go on with my wrapping 
efforts. I could wrap a whole bunch of new classes before I hit another 
bug in pyplusplus. There is this one class method that takes an unsigned 
int with default value as argument. Pyplusplus then generates code like 
this:

  .def( "foo",
        &MyClass::foo,
        (bp::arg("index")=unsigned int(0)),
        bp::default_call_policies() )

When compiled with gcc I get a syntax error in the third line. The code 
only compiles when I put brackets around the "unsigned int":

        (bp::arg("index")=(unsigned int)(0)),


- Matthias -




More information about the Cplusplus-sig mailing list