I'm passing a float as dynamic PyObject from Python to C# and this kind of assignment is automagically accepted:
double csharpfloat = PythonFunctionReturningFloat();
But when using this PyObject in other numerical operations, then explicit casting is required:
double csharpfloat = 1/(double)PythonFunctionReturningFloat(); double csharpfloat += (double)PythonFunctionReturningFloat();
Any reason for such inconsistent behavior?
This is probably a shortcoming of C# itself. The first example is an initialisation while the other two examples are expressions.
Activity
filmor commented on Jun 9, 2020
This is probably a shortcoming of C# itself. The first example is an initialisation while the other two examples are expressions.