Skip to content

Docs: Update py::kwargs example in function.rst to pass by reference #3038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/advanced/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)) << ", "
Expand Down Expand Up @@ -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
Expand Down