Opened 13 years ago

Last modified 13 years ago

#3488 new Feature Requests

A better way to make python functions that take arbitrary number of args than raw_function

Reported by: loonycyborg Owned by: Dave Abrahams
Milestone: To Be Determined Component: python USE GITHUB
Version: Boost 1.40.0 Severity: Problem
Keywords: Cc: dbsgeo@…

Description

raw_function can handle only C++ functions that take two args (tuple, dict) and seems to cause static assert if a keyword-expression is passed to def thus causing a lot of manual code if one wants to make it take named arguments or default arguments.

It would be nice if there was a way to make such functions closer to defs in python itself, something like this:

void foo(int arg1, int arg2, tuple args, dict kw);

def("foo", foo, (arg("arg1") = 1, arg("arg2") = 2, arg("*args"), arg("**kw")) // that would pass extra positional args in foo's third arg and extra keyword args to foo's fourth arg

Change History (1)

comment:1 by Dane Springmeyer <dbsgeo@…>, 13 years ago

Cc: dbsgeo@… added
Note: See TracTickets for help on using tickets.