Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-08-16 18:46:27


Yes, there's a difference. The difference is that when wrapping a
constructor, you have to specify the argument list. When wrapping a member
function, you don't. It would certainly be possible to add similar
functionality for member functions:

my_class_builder.def(&my_class::f, boost::python::args<int, char*, char>(),
"f");
my_class_builder.def(&my_class::f, boost::python::args<int, char*>(), "f");
my_class_builder.def(&my_class::f, boost::python::args<int>(), "f");

Perhaps that would make people who want default args happier.

-Dave

----- Original Message -----
From: "John Hunter" <jdhunter_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, August 16, 2001 7:20 PM
Subject: Re: [boost] Re: python member function naming problem

> >>>>> "rwgk" == rwgk <rwgk_at_[hidden]> writes:
>
> rwgk> Maybe I am missing something, but I believe that it is
> rwgk> straight-forward to do what you want:
>
> I assumed that Ralf's comment regarding member functions "However, the
> default arguments are lost at the Python level." would apply to
> constructors as well. But I tried your approach on my class, and in
> the cases I have tested, it appears to get the optional argument
> right. Is there a difference in this regard between constructors and
> member funcs, or am I confused?
>
> Thanks
> John Hunter
>
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk