Hi.

FYI, The division operators are discussed at length in 
http://www.python.org/peps/pep-0238.html.

// means, and always will mean, "floor division".

Cheers,

--david

Matthew Sherborne wrote:

> On Python 2.2 I like the new div operator //, which I likened to 
> Delphi's 'div' ie. Integer Division. However I surprised to realize 
> that not only 5//2==2 but that I can also say that 5 // 1.5 == 3.0!
>
>  
>
> So I now realize that it is not "Integer Division", it is "Division 
> with the result rounded down".
>
>  
>
> I hope that I will still be able to 5 // 1.5 in future versions of 
> python because I'm putting it in my prorgam!
>
>  
>
> It's shorter than 'from math import floor; floor(5/1.5);'.
>
>  
>
> >>> from __future__ import
>
> >>> 5 // 1.5
>
> 3.0
>
> >>> 5 / 1.5
>
> 3.3333333333333335
>
>  
>
> Amazing! Thanks Guido and friends :)
>
> Matthew Sherborne
>


_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to