Replies: 1 comment
-
I think this discussion is probably more relevant to the In any case, maybe the example provided here is helpful for you as an example of how to implement polymorphism like use the derive macro for Concerning the question on #[derive(FromPyObject)]
pub enum ArrayLike<'a> {
Float(f64),
Int(isize),
FloatArray(PyReadonlyArrayD<'a, f64>),
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
From Python I am trying to convert an object into the following structure:
I have this working, with the following definition and the standard
pyo3
setup:Note that there is an
unsafe
block for the numpy array conversion. The documentation ofas_array
suggests to either use aPyReadonlyArray
or theto_array
method.to_array
method on the documentation for latest. Does it exist, or is the documentation old?PyReadonlyArray
by changing the code tobut this results in
the trait 'PyNativeType' is not implemented for 'PyReadonlyArray<'_, f64, Dim<IxDynImpl>>'
. Any suggestions on how to usePyReadonlyArray
?Beta Was this translation helpful? Give feedback.
All reactions