Has anyone noticed that a function created with boost::python using
args() to give keyword arguments doesn't seem to work with 
functools.partial keyword arguments (but does with positional args)?

For example, I have this function:
  class_<boost_uniform_real_wrap>
    ("uniform_real", "Uniform float distribution", 
bp::init<rng_t&,double,double>(
        (bp::arg ("rng"),
         bp::arg ("min"),
         bp::arg ("max"))...

Then:
from functools import partial
f = partial (uniform_real, rng=rng1) << using keyword doesn't work
f (1,2)
ArgumentError: Python argument types in
    uniform_real.__init__(uniform_real, int, int)
did not match C++ signature:
    __init__(_object*, boost::random::mersenne_twister<unsigned int, 
32, 624, 397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 
18, 3346425566u> {lvalue} rng, double min, double max)

But this works:
from functools import partial
f = partial (uniform_real, rng1) << pos arg does work

In [27]: f(1,2)
Out[27]: uniform_real(1,2)


_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to