Python中既有强制类型转换也有强迫同型,通常使用更多的是前者(“显式优于隐式”)。
Python contains a mixture of casts and coercions, with a usual preference for the former (" explicit is better than implicit ").
解释类型转换的概念以及隐式和显式转换的不同。
Explains the concept of type conversion and the distinction between implicit and explicit conversion.
显式构造函数不能参与隐式转换。
An explicit constructor cannot take part in implicit conversions.
应用i MPES方法将数学模型转换为隐式求解压力、显式求解饱和度的数值模型。
IMPES method is used to convert the mathematical model into a numerical model for an implicit solution of pressure and an explicit solution of saturation.
显式数值转换用于通过显式转换表达式,将任何数字类型转换为任何其他数字类型。对于它不存在隐式转换。
Explicit numeric conversion is used to convert any numeric type to any other numeric type, for which there is no implicit conversion, by using a cast expression.
但是,因为隐式转换不需要程序员将一种类型显式强制转换为另一种类型,所以使用隐式转换时必须格外小心,以免出现意外结果。
However, because implicit conversions do not require programmers to explicitly cast from one type to the other, care must be taken to prevent unexpected results.
如果范围变量是显式类型的,请确保该类型与循环访问的集合中的元素类型相同或可从该类型隐式转换。
If the range variable is explicitly typed, make sure that the type is either the same as, or implicitly convertible from, the type of the elements in the collection it iterates.
如果范围变量是显式类型的,请确保该类型与循环访问的集合中的元素类型相同或可从该类型隐式转换。
If the range variable is explicitly typed, make sure that the type is either the same as, or implicitly convertible from, the type of the elements in the collection it iterates.
应用推荐