[C++-sig] Calling python from c++ with tuple and dict args.

David Abrahams dave at boost-consulting.com
Tue Mar 7 20:26:15 CET 2006


Alex Mohr <amohr at pixar.com> writes:

> Thanks Markus,
>
> I was planning to use PyObject_Call which takes a tuple and a dict if I 
> couldn't find a nice boost python way to do it.
>
> It seems like it would be possible to do something like this:
>
> bp::object::operator()(bp::unpacked_tuple const &args,
>                         bp::unpacked_dict const &kw) {
>      // call as self(*args, **kw)
> }
>
> And then define unary * operators for tuple and dict so that *tuple 
> would produce an unpacked_tuple and **dict would produce an unpacked_dict.
>
> Alex

That's ******* E V I L *****  !!!

and I love it!  Post a patch including tests and I'll check it in.

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




More information about the Cplusplus-sig mailing list