1 [section boost/python/raw_function.hpp]
3 `raw_function(...)` is used to convert a function taking a [link object_wrappers.boost_python_tuple_hpp.class_tuple `tuple`] and a [link object_wrappers.boost_python_dict_hpp.class_dict `dict`] into a Python callable object which accepts a variable number of arguments and arbitrary keyword arguments.
5 [section Function `raw_function`]
8 object raw_function(F f, std::size_t min_args = 0);
11 [[Requires][f(tuple(), dict()) is well-formed.]]
12 [[Returns][a callable object which requires at least min_args arguments. When called, the actual non-keyword arguments will be passed in a tuple as the first argument to f, and the keyword arguments will be passed in a dict as the second argument to f. ]]
18 #include <boost/python/def.hpp>
19 #include <boost/python/tuple.hpp>
20 #include <boost/python/dict.hpp>
21 #include <boost/python/module.hpp>
22 #include <boost/python/raw_function.hpp>
24 using namespace boost::python;
26 tuple raw(tuple args, dict kw)
28 return make_tuple(args, kw);
31 BOOST_PYTHON_MODULE(raw_test)
33 def("raw", raw_function(raw));
38 >>> from raw_test import *
40 >>> raw(3, 4, foo = 'bar', baz = 42)
41 ((3, 4), {'foo': 'bar', 'baz': 42})