docs: Precise the abscense of `py: Python` for the #[pyo3(signature)]

This commit is contained in:
Julien Jerphanion 2023-01-29 21:11:04 +01:00 committed by David Hewitt
parent cb38ff0111
commit 9306d56b27
1 changed files with 16 additions and 0 deletions

View File

@ -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