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
|
- Re: New // operator Matthew Sherborne
- Re: New // operator David Ascher
- Re: New // operator Syver Enstad
- Re: New // operator Eric Sloane
- Re: New // operator Jeff Shannon
- RE: New // operator Kari Hoijarvi
- Re: New // operator David Ascher