I am trying to iterated over a python list and compare the values to those in a Mojo Float32 list, but I have not found a way of converting a python float to any Mojo type for comparison.
I’ve tried Float32(f.to_float64()), but to_float64() returns a PythonObject and Float32 cannot convert a PythonObject. The same happens with Float64(f). Replacing the Float## with SIMD[DType.float##] also doesn’t work, and removing the to_float64() doesn’t work either.
Does anyone know what I am doing wrong or how I can fix this?
Sorry for the delay, I thought I already sent this. This solution works! I suppose the issue I was having before was that I wasn’t including PythonObject. It seems a strange requirement given that I had already been interacting with PythonObjects. I also had been using 26.0.2. Thanks!