From: Mark Sparshatt Date: 2004-06-05T19:03:03+09:00 Subject: Re: [RCR] Floating point division operator /. (or fdiv method) Michael Neumann wrote: >>This is one area where (IMHO) Python took the right choice. (I can't >>believe I said that). >> >> > >Well, I believed that's how Python works as well. But in Python (2.3): > > >>> 1 / 2 > 0 > > >>> 1 // 2 > 0 > > >>> 1.0 // 2 > 0.0 > > >>> 1.0 / 2 > 0.5 > > >>> 1 / 2.0 > 0.5 > >So they have the same "problem" as we in Ruby. But AFAIK, they can >better control the impacts than Ruby can (limited to module scope?). > > However GvR has decided to fix the problem in the way you suggest, by making // mean integer division and for / to mean float division. Try this >>> 1/2 0 >>> from __future__ import division >>> 1/2 0.5 >>> 1//2 0 That's using version 2.3.3 -- Mark Sparshatt