MATLAB2Python

Tony Meyer t-meyer at ihug.co.nz
Thu Apr 29 19:36:54 EDT 2004


> An indication that Python takes the interests of beginning 
> programmers more seriously than those of experienced 
> scientific programmers is that integer division is going to 
> be redefined in future versions of the language -- 2/3 = 1 
> now but will equal 1.5 in the future. (I think you are 
> supposed to use 2//3).

This is almost right :)

>>> 2/3
0
>>> 2//3
0
>>> from __future__ import division
>>> 2/3
0.66666666666666663
>>> 2//3
0

I think maybe 3/2 or 3//2 was the intent :)

=Tony Meyer





More information about the Python-list mailing list