On 06/21/2012 06:07 PM, Trigve Siver wrote:
From: Jim Bosch <tallji...@gmail.com>
To: cplusplus-sig@python.org
Cc:
Sent: Thursday, June 21, 2012 11:57 PM
Subject: Re: [C++-sig] C++ clas with (*args, **kwargs) constructor
On 06/21/2012 05:31 PM, Trigve Siver wrote:
Hi,
I'm trying to find some solution to my problem but without succes. I
need to be able to export C++ class constructor that takes arbitraty arguments
(as in python __init__(self, *args, **kwargs). Is it possible to have this kind
of constructor? I've tried something like this:
I believe this is not possible in Boost.Python. The closest approximations I
know of are:
- Use a static method or free function instead of a constructor for this mode of
construction in Python. You can wrap a non-constructor with *args, **kwds using
boost::python::raw_function.
- Inherit from the wrapped class at the Python layer; the derived class could
then have a constructor with *args, **kwds.
Thanks for reply :) Hmm I was trying with python::raw_function, but without
success also. Ok I'm gonna try a bit more with raw_constructor once more.
Heh, I didn't even know about raw_constructor, because it isn't in the
reference docs for some reason. If it exists, then your problem very
likely is solvable and my response was totally bogus.
Glad I didn't discourage you.
Jim
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig