Roman Yakovenko wrote:
>> implemented (besides that, the function transformers already do add
>> themselves to a wrapper class if there is one, but they just don't force
>> the creation of a wrapper class).
>
> They should. Can you give me few good reasons to not create wrappers?
Besides being an unnecessary layer of complexity that doesn't serve any
useful purpose and just leads to larger source files and executables, it
breaks my regression test.
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.
- Matthias -
|