On 9/21/06, Roman Yakovenko <rom...@gm...> wrote:
> > It's the vector class again. This class has a couple of predefined
> > vectors as static members such as, for example, "zero" which is the
> > vector (0,0,0).
> > Doing an operation such as adding two vectors doesn't work anymore if
> > one operand is instantiated in Python and the other one is one of the
> > above predefined vectors:
> >
> > a = Vector(1,2,3) # this will be a Vector_wrapper instance
> > b = Vector.zero # this will be a Vector instance
> > c = a+b # fails
> >
> > I don't know exactly what happens here inside Boost.Python, but my guess
> > would be that the addition is only defined between two *wrapper* classes
> > and not between a wrapper class and the original class.
> >
> > I've experienced such things before with other libraries which is why
> > I'm only creating wrapper classes when it is absolutely necessary.
>
> This is a valid point, that I should check.
Do you mind to post small test case that reproduce the error?
Also, before you do this, can you check whether redefine_operators = True
solves the problem?
mb = module_builder_t( ... )
mb.class_('Vector' ).redefine_operators = True
Thank you.
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|