[C++-sig] Re: (return_self_policy / return_arg): Keywors
Nikolay Mladenov
nickm at sitius.com
Mon Jun 30 03:07:21 CEST 2003
This is how I use it:
/////the.cpp////
python::class_<FileDialog, FileDialogPyX, boost::noncopyable>
("FileDialog", python::no_init)
.def(python::init<const char *
, const char *
, const char *
, const char *
, const char *
>(python::args(
python::arg("title") = (const
char *)0
, python::arg("prompt") = (const
char *)0
, python::arg("extension") =
(const char *)0
, python::arg("directory")=
(const char *)0
, python::arg("file")= (const
char *)0
))
)
.def(python::init<python::optional<
const char *
, const char *
, const char *
, const char *
, const char *
>
>()
)
/////the.py////
fd1 = FileDialog()
fd2 = FileDialog("Title")
fd2 = FileDialog(title="Title")
fd2 = FileDialog("Title", extension='.py', prompt='Select your script')
David Abrahams wrote:
>
> Nikolay Mladenov <nickm at sitius.com> writes:
>
> > Dave,
> >
> > That is what I have as diffs now. The diffs are from somewhat old cvs
> > state (1.29.0).
> > I've been using it for quite some time for init<> and it seems to be
> > working nicely, but I have no tests, nor docs.
> > If you approve this though, I will write docs and tests.
>
> I need to see some examples/description to know what it does, I think.
> IIRC it has something to do with defaulted keyword arguments? If it's
> what I remember, I'd be very enthusiastic about adding it to the
> library!
>
> Thanks,
> Dave
>
> Nit: the coding style should be made consistent with the rest of the
> library. These don't really fit:
>
> > std::size_t j = nargs, k = nargs, size=PyTuple_GET_SIZE(f->m_arg_names.ptr());
>
> > }else ++k;
>
I will look into this. If you mean that some new line are missing,
consider it fixed.
> --
> Dave Abrahams
> Boost Consulting
> www.boost-consulting.com
More information about the Cplusplus-sig
mailing list