[Numpy-discussion] Fixed scalar coercion model in NumPy
Mon Mar 26 16:30:25 CDT 2007
Perry Greenfield wrote:
>On Mar 26, 2007, at 4:52 PM, Travis Oliphant wrote:
>>I've finally made the changes to fix the scalar coercion model
>>in NumPy 1.0.1
>>Now, scalar coercion rules only apply when involved types are of the
>>same basic "kind".
Actually, the rule is better stated. The scalar coercion rules apply
when involved types are of the same basic "kind" or if the scalar is of
"lesser" kind than the array.
array([1,2,3],float32)*10 produces a float32 array
array([1,2,3],float32)*10.0 produces a float32 array
array([1,2,3],float32)*10.0j produces a complex128 array
More information about the Numpy-discussion