Skip to content

Commit

Permalink
docs: Precise the abscense of py: Python for the #[pyo3(signature)]
Browse files Browse the repository at this point in the history
  • Loading branch information
jjerphan authored and davidhewitt committed Feb 3, 2023
1 parent cb38ff0 commit 9306d56
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions guide/src/function/signature.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@ impl MyClass {
}
}
```

Arguments of type `Python` must not be part of the signature:

```rust
# #![allow(dead_code)]
# use pyo3::prelude::*;
#[pyfunction]
#[pyo3(signature = (lambda))]
pub fn simple_python_bound_function(
py: Python<'_>,
lambda: PyObject,
) -> PyResult<()> {
Ok(())
}
```

N.B. the position of the `/` and `*` arguments (if included) control the system of handling positional and keyword arguments. In Python:
```python
import mymodule
Expand Down

0 comments on commit 9306d56

Please sign in to comment.