File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -437,9 +437,9 @@ Certain argument types may support conversion from one type to another. Some
437437examples of conversions are:
438438
439439* :ref: `implicit_conversions ` declared using ``py::implicitly_convertible<A,B>() ``
440- * Passing an argument that implements ``__float__ `` to ``float `` or ``double ``.
441- * Passing an argument that implements ``__int__ `` to ``int ``.
442- * Passing an argument that implements ``__complex__ `` to ``std::complex<float> ``.
440+ * Passing an argument that implements ``__float__ `` or `` __index__ `` to ``float `` or ``double ``.
441+ * Passing an argument that implements ``__int__ `` or `` __index__ `` to ``int ``.
442+ * Passing an argument that implements ``__complex__ ``, `` __float__ ``, or `` __index__ `` to ``std::complex<float> ``.
443443 (Requires the optional ``pybind11/complex.h `` header).
444444* Calling a function taking an Eigen matrix reference with a numpy array of the
445445 wrong type or of an incompatible data layout. (Requires the optional
@@ -455,7 +455,7 @@ object, such as:
455455 m.def("supports_float", [](double f) { return 0.5 * f; }, py::arg("f"));
456456 m.def("only_float", [](double f) { return 0.5 * f; }, py::arg("f").noconvert());
457457
458- ``supports_float `` will accept any argument that implements ``__float__ ``.
458+ ``supports_float `` will accept any argument that implements ``__float__ `` or `` __index__ `` .
459459``only_float `` will only accept a float or int argument. Anything else will fail with a ``TypeError ``:
460460
461461.. note ::
You can’t perform that action at this time.
0 commit comments