-
I have a function of the form: #[pyfunction]
pub fn example(a: Vec<String>) -> PyResult<bool> {
// Do things.
Ok(true)
} The variable #[pyfunction]
#[pyo3(signature = (a=["x", "y", "z"]))]
pub fn example(a: Vec<String>) -> PyResult<bool> {
// Do things.
Ok(true)
} ...then I get the error:
The
So I also tried: #[pyfunction]
#[pyo3(signature = (a=vec!["x", "y", "z"]))]
pub fn example(a: Vec<String>) -> PyResult<bool> {
// Do things.
Ok(true)
} But this yields a similar error:
I have read #4830 and reviewed the table of argument types, but the suggested solutions didn't help (just variations of the above error about being unable to convert |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Ack, okay, I am incredibly dumb. This is not a #[pyfunction]
#[pyo3(signature = (a=vec!["x".to_string(), "y".to_string(), "z".to_string()]))]
pub fn example(a: Vec<String>) -> PyResult<bool> {
// Do things.
Ok(true)
} For good measure, it may be useful to also override the |
Beta Was this translation helpful? Give feedback.
Ack, okay, I am incredibly dumb. This is not a
pyo3
issue, this is an "I am bad at confusing Python and Rust" issue. The correct way to do this is:For good measure, it may be useful to also override the
__text_signature__
to hide all this Rust-specific stuff.