[C++-sig] Calling python from c++ with tuple and dict args.
David Abrahams
dave at boost-consulting.com
Wed Mar 8 20:58:03 CET 2006
Alex Mohr <amohr at pixar.com> writes:
>> not
>>
>> o(A1..N, unpacked_dict_args)
>>
>> as well?
>
> Yes -- that too, and that's what I've implemented.
>
>> That won't work with the old broken compilers (vc6/7), I think, which
>> -- at least for now -- are still supported. But I think it's pretty
>> easy to do something inside boost/python/call.hpp to make it recognize
>> the unpacked tuple and dict arguments and treat them specially.
>
> Interesting. The only environments I have readily available are gcc 4+
> on linux and vc-8_0 on Windows and the obvious thing seems to work on
> those. So I'll likely need some help with supporting the older
> compilers. Or -- is there an existing pattern somewhere that I can look at?
Just don't rely on partial ordering or partial specialization. Detect
the special types inside of each call<> overload using type traits and
handle them appropriately using some kind of metaprogramming.
>> If you just modify boost::python::call<> you don't need to touch
>> anything else.
>
> That's true -- I'll do that. There is the question of whether
> unpacked_tuple and unpacked_dict should count against MAX_ARITY though.
> That is, is MAX_ARITY the max number of explicit positional args, or
> is MAX_ARITY the max number of c++ args?
Make it the latter; it will be simpler.
> What is the preferred way of generating a patch to post to the list?
_enclose_ (rather than paste) a unified diff into a post.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list