Division considered un-Pythonic (Re: Case-sensitivity: why -- or why not? (was Re: Damnation!))
Andrew Dalke
dalke at acm.org
Fri Jun 2 12:22:17 EDT 2000
piet at cs.uu.nl wrote:
>As it is now in Python, you can have a==b and c==d both being true, but
>a/c==b/d being false. Which would be a bad surprise for most people.
At the very least, not to many programmers. It's the same behaviour
in C:
> cat > tmp.c
#include <stdio.h>
main() {
int i=7, j=2;
float x=7.0f, y=2.0f;
printf("i==x : %d\n", i==x);
printf("j==y : %d\n", j==y);
printf("i/j==x/y : %d\n", (i/j)==(x/y));
}
> /usr/local/bin/gcc tmp.c
> ./a.out
i==x : 1
j==y : 1
i/j==x/y : 0
>
Andrew
dalke at acm.org
More information about the Python-list
mailing list