[Numpy-discussion] division operator

Pearu Peterson pearu.peterson at gmail.com
Mon Apr 4 06:57:02 EDT 2011



On 04/04/2011 01:49 PM, Alex Ter-Sarkissov wrote:
> I have 2 variables, say var1=10,var2=100. To divide I do either
> divide(float(var1),float(var2)) or simply float(var1)/float(var2). I'm
> just wondering if there's a smarter way of doing this?

 >>> from __future__ import division
 >>> var1 = 10
 >>> var2 = 100
 >>> print var1/var2
     0.1

HTH,
Pearu



More information about the NumPy-Discussion mailing list