Hi, In native Python I can do something like this: def goo(a,b,c): return a+b+c ll = [1,2,3] goo( *ll ) And it will pass all the arguments properly. I need similar functionality in C++: Given bp::object func; bp::list args; I'd like to invoke the function like this func( *args ); Is there syntax in Boost.Python to achieve this? Or I need to resort to ugly switch statement? Gennadiy
On 10/09/2009 02:25 AM, Gennadiy Rozental wrote:
Hi,
In native Python I can do something like this:
def goo(a,b,c): return a+b+c
ll = [1,2,3] goo( *ll )
And it will pass all the arguments properly. I need similar functionality in C++:
Given
bp::object func; bp::list args;
I'd like to invoke the function like this func( *args );
Is there syntax in Boost.Python to achieve this? Or I need to resort to ugly switch statement?
I added support for the above quite a while ago (and I'm assured that this time it even made it into the release branch in time ;-) ). Thus, you can construct a list and keyword, then pass to a python callable as '*args' and '**kwds' respectively. Regards, Stefan -- ...ich hab' noch einen Koffer in Berlin...
Stefan Seefeld <seefeld <at> sympatico.ca> writes:
I added support for the above quite a while ago (and I'm assured that this time it even made it into the release branch in time ). Thus, you can construct a list and keyword, then pass to a python callable as '*args' and '**kwds' respectively.
Right. So no luck with 1.33.1 guess ;) Will it get into 1.41? Gennadiy
On 10/09/2009 04:19 PM, Gennadiy Rozental wrote:
Stefan Seefeld<seefeld<at> sympatico.ca> writes:
I added support for the above quite a while ago (and I'm assured that this time it even made it into the release branch in time ). Thus, you can construct a list and keyword, then pass to a python callable as '*args' and '**kwds' respectively.
Right.
So no luck with 1.33.1 guess ;)
Will it get into 1.41?
With 'this time' I was referring to the 1.40 release. So yes, it will be in 1.41, too. :-) Stefan -- ...ich hab' noch einen Koffer in Berlin...
participants (2)
-
Gennadiy Rozental -
Stefan Seefeld