Skip to content

Commit c13f21e

Browse files
committed
Update docs to mention other conversions
1 parent 2163f50 commit c13f21e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/advanced/functions.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,9 @@ Certain argument types may support conversion from one type to another. Some
437437
examples 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::

0 commit comments

Comments
 (0)