implicit conversions vs calling explicit constructors
Matlab lists four Python types that are implicitly converted to its own types, bool, int, float, and complex. Any Python function that returns one of those types has the value automatically converted to the equivalent Matlab type.
However, what about calling the object constructor explicitly? This may return the unconverted Python type rather than doing the normal implicit conversion. IOW any function return value, unless that function happens to be a type constructor.
Here are some relevant tests to see how Matlab handles them.
py.bool(0)
py.bool(1)
py.int(0) %% only if pyversion is Python 2
py.math.pi
py.math.sqrt(2)
py.float(pi)
py.numpy.float64(pi)
py.cmath.sqrt(-1)
py.complex(2)
py.complex(2j)
Edited by Mike Miller