Skip to content
Discussion options

You must be logged in to vote

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:

#[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 __text_signature__ to hide all this Rust-specific stuff.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jdaymude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant