[C++-sig] Questions about doing advanced things with pyplusplus
roman.yakovenko at gmail.com
Thu Feb 23 07:35:53 CET 2006
On 2/16/06, Matthias Baas <baas at ira.uka.de> wrote:
> Roman Yakovenko wrote:
> Isn't there sort of a duality between the declaration tree and the code
> creator tree? From what I understand at the moment, at least every
> exposed node in the declaration tree will have a corresponding node in
> the code creator tree (is this correct?).
Almost, For example function that takes an argument pointer to an
other function will not
have node in code creators tree. Also include_t code creator does not
have analog in
> Then I think it would also be possible (and useful) to attach all of the
> above things to the declaration tree and pass them to the constructor of
> the corresponding code creator. This way I don't have to search for
> virtually the "same" node twice (once in the declaration tree and once
> in the code creator tree).
You don't have. You will use declarations tree to configure code creators.
> >> q5: How do I add methods? (can you provide example code to do this)
> > Take a look on py_date_time example, _customize_classes method.
> > http://tinyurl.com/e44kh
> This is extremely low level, isn't it? Aren't you virtually bypassing
> pyplusplus if you directly set things like
> def( "min", &%s::min, bp::default_call_policies() )
> pyplusplus then has no chance of knowing the semantics of this text.
> What if this definition should be involved in the reordering process?
After code creators tree is constructed, reordering is done by developer.
>Is it really guaranteed that the Boost.Python namespace is always called
In my case - yes :-). Also you can change it.
> I couldn't use the standard mechanism for assigning doc strings
> (once there is one).
This is not true, you can insert your documentation into the string itself.
> I would prefer a solution where I can manipulate such a new method just
> as if it was part of the C++ class (hence the suggestion for an
> add_method() function).
There is already exist one. You can create
class instance, fill the data/properties - that's all. It is not to
difficult, but the process is much longer then injecting right code in
the right place.
C++ Python language binding
More information about the Cplusplus-sig