need some help setting correct docstrings #49
Replies: 2 comments 1 reply
-
|
Yep those look correct. Although the order of the arguments passed to the "extra" parameter doesn't matter he figures out there functionality based their type. We should probably chose an order for consistency though, my vote would be nb::rv_policy comes last for consitency and now I've come to realize the default value is probably fine in most cases so it doesn't even need to be set... So for |
Beta Was this translation helpful? Give feedback.
-
|
We have no choice for the first two arguments for order (name and Func) but I think this order makes sense and is consistent with what is already there: NAME, FUNC, ARG_NAME1, ARG_NAME2..., DOCSTRING, OTHER_ANNOTATIONS, RETURN_VALUE_POLICY |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
hey @keithlostracco , even though you prepped an example my brain has trouble converting the bindings to correct version with a docstring.
The only nanobind docs about this I could find are here, and from that I derive that last argument can always be a docstring:
https://nanobind.readthedocs.io/en/latest/api_core.html#_CPPv4I0DpEN8nanobind6class_3defER6class_PKcRR4FuncDpRK5Extra
so if I have defined my docstrings like this
And if I want to convert this:
.def("start", &Comp::start, nb::rv_policy::reference_internal)should it be like this below?
.def("start", &Comp::start, nb::rv_policy::reference_internal, startDoc)And
.def("start_next_frame", &Comp::startNextFrame, "time_value"_a = 0, "time_scale"_a = 0, nb::rv_policy::reference_internal)should be this?
.def("start_next_frame", &Comp::startNextFrame, "time_value"_a = 0, "time_scale"_a = 0, nb::rv_policy::reference_internal, start_next_frameDoc)Beta Was this translation helpful? Give feedback.
All reactions