Question about Py 2.2.x division operator

ahimsa ahimsa at onetel.net.uk
Sun Dec 29 14:35:37 EST 2002


I am using Python 2.2c1 and have a query regarding the use of division
operators.
I haven't seen this covered previously, but if it has, my apologies for
redundancy.
I understand that pre-2.2 the '/' would only perform 'floor' division
and truncate the remainder -- e.g. 7 / 4 == 1 -- but that with 2.2 '//'
would be used for floor division and '/' would be used for true division
-- e.g. 7 // 4 == 1 while 7 / 4 == 1.75. When I try this I can get the
fraction by using real numbers (i.e. 7.0 / 4 == 1.75) *without*
importing the future module, so what are the advantages of importing the
division component of the 'future' module unless I was only going to be
using integers? Would it be a useful 'failsafe' to reduce errors?

Cheers
AmF

-- 
ahimsa <ahimsa at onetel.net.uk>





More information about the Python-list mailing list