From cd4b49a2c8c659d3933cf902bb10e34931dbd1e7 Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Thu, 17 Jun 2021 16:20:17 -0400 Subject: [PATCH 1/2] Update py::kwargs examples to pass by reference (#3038) --- docs/advanced/functions.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/advanced/functions.rst b/docs/advanced/functions.rst index f6061ffbe..d880008b0 100644 --- a/docs/advanced/functions.rst +++ b/docs/advanced/functions.rst @@ -254,7 +254,7 @@ For instance, the following statement iterates over a Python ``dict``: .. code-block:: cpp - void print_dict(py::dict dict) { + void print_dict(const py::dict& dict) { /* Easily interact with Python types */ for (auto item : dict) std::cout << "key=" << std::string(py::str(item.first)) << ", " @@ -292,7 +292,7 @@ Such functions can also be created using pybind11: .. code-block:: cpp - void generic(py::args args, py::kwargs kwargs) { + void generic(py::args args, const py::kwargs& kwargs) { /// .. do something with args if (kwargs) /// .. do something with kwargs From b4b67f026bc2aa1a1ae17e9858a9e61210c77c31 Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Thu, 17 Jun 2021 16:39:59 -0400 Subject: [PATCH 2/2] Fix typos (#3044) --- docs/advanced/pycpp/numpy.rst | 2 +- docs/compiling.rst | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/advanced/pycpp/numpy.rst b/docs/advanced/pycpp/numpy.rst index 0a81aa8fd..53ec8c1a3 100644 --- a/docs/advanced/pycpp/numpy.rst +++ b/docs/advanced/pycpp/numpy.rst @@ -390,7 +390,7 @@ operation on the C++ side: py::array b = a[py::make_tuple(0, py::ellipsis(), 0)]; .. versionchanged:: 2.6 - ``py::ellipsis()`` is now also avaliable in Python 2. + ``py::ellipsis()`` is now also available in Python 2. Memory view =========== diff --git a/docs/compiling.rst b/docs/compiling.rst index 3a8a270d5..27f30e5a0 100644 --- a/docs/compiling.rst +++ b/docs/compiling.rst @@ -149,7 +149,7 @@ Your ``pyproject.toml`` file will likely look something like this: and ``pyproject.toml`` are not even contained in the wheel, so this high Pip requirement is only for source builds, and will not affect users of your binary wheels. If you are building SDists and wheels, then - `pypa-build`_ is the recommended offical tool. + `pypa-build`_ is the recommended official tool. .. _PEP 517: https://www.python.org/dev/peps/pep-0517/ .. _cibuildwheel: https://cibuildwheel.readthedocs.io @@ -411,7 +411,7 @@ existing targets instead: .. code-block:: cmake - cmake_minumum_required(VERSION 3.15...3.19) + cmake_minimum_required(VERSION 3.15...3.19) project(example LANGUAGES CXX) find_package(Python COMPONENTS Interpreter Development REQUIRED) @@ -516,7 +516,7 @@ Instead of setting properties, you can set ``CMAKE_*`` variables to initialize t compiler flags are provided to ensure high quality code generation. In contrast to the ``pybind11_add_module()`` command, the CMake interface provides a *composable* set of targets to ensure that you retain flexibility. - It can be expecially important to provide or set these properties; the + It can be especially important to provide or set these properties; the :ref:`FAQ ` contains an explanation on why these are needed. .. versionadded:: 2.6