def upcast_scalar(dtype, scalar):
 return (np.array([0], dtype=dtype) * scalar).dtype

def upcast_scalar ( dtype , scalar ) : return ( np . array ( [ 0 ] , dtype = dtype ) * scalar ) . dtype
determine data type for binary operation between an array of type dtype and a scalar .