Multiplying sequences with floats

Andrew Koenig ark at acm.org
Fri Mar 24 13:58:53 EST 2006


"Christoph Zwerschke" <cito at online.de> wrote in message 
news:dvvfpu$s0q$1 at online.de...

> Anyway this would be an argument only against the variant of typecasting a 
> float with a fractional part. But what about the other variant which 
> raises an error if there is a fractional part, but works if the float is 
> actually an exact integer, like the result of 4.0//2.

I think that's a really bad idea, because of the possibility that the result 
might happen to be an exact integer on one implementation but not another. 
In such situations, the fact that it might fail on implementation X may well 
be impossible to detect by any amount of testing on implementation Y.  Such 
untestable errors are such a nuisance that it would better for the language 
to encourage programmers to give them a wide berth.





More information about the Python-list mailing list