[C++-sig] Re: calling python method using keywords

David Abrahams dave at boost-consulting.com
Mon Jan 12 19:13:18 CET 2004


Stefan Seefeld <seefeld at sympatico.ca> writes:

> David Abrahams wrote:
>
>>>args = tuple('a', 'b')
>>>kwds = {'c':'C', 'd':'D'}
>>>
>>>f = foobar(*args, **kwds)
>>>
>>>I can't find any documentation on this, though.
>>>Is there a predefined 'call' function with the
>>>appropriate signature ?
>> Do you mean that you want to do this from C++?
>
> yes. I already know how to do it in python ;-)

The other interpretation would've been that you want to wrap a C++
function so it can be used that way from Python.

For now, you have to go to the Python 'C' API to do it.  I just
realized that Python doesn't have any unary operator*, so we could
make the 

   foobar(*args, **kwds);

syntax work in C++.  Not implemented yet, though ;-)

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list