[C++-sig] Boost::Python: inheritance + optional parameters

Sybren A. Stüvel sybren at stuvel.eu
Tue May 1 14:43:54 CEST 2012


On 27 April 2012 17:17, Jim Bosch <talljimbo at gmail.com> wrote:

> Have you tried using the keyword argument approach to handling default
> arguments?  More precisely, something like this should work, I think:
>
> def("override", func, (arg("x"), arg("y")=0, arg("z")=false))
>
> (where func is the usual wrapper override function).
>

It does, nearly, and I tweaked it to:

def("override", WrapperClass::func, WrapperClass::default_func, (arg("x"),
arg("y")=0, arg("z")=false))

Thank you for your quick answer, you have helped me a lot.

Kind regards,
-- 
Sybren A. Stüvel

http://stuvel.eu/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20120501/6df22d8e/attachment.html>


More information about the Cplusplus-sig mailing list