Skip to content

How to accept a Python string or Python None in a function #2932

Discussion options

You must be logged in to vote

Try adding a signature indicating that the arguments are mandatory and do not have a default value, e.g.

#[pyfunction]
#[pyo3(signature=(arg1, arg2))]
fn my_function(arg1: Option<String>, arg2: Option<String>) {

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by hwittenborn
Comment options

You must be logged in to vote
3 replies
@birkenfeld
Comment options

@adamreichold
Comment options

@adamreichold
Comment options

Comment options

You must be logged in to vote
1 reply
@hwittenborn
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants