baffling bug in this bit of code!
Daniel Jaeggi
jaeggi at NOSPAMembl-heidelberg.de
Wed Jul 3 09:51:24 EDT 2002
Max M wrote:
> Are you shure you are not comparing apples and oranges here ???
>
> erhh I mean strings and integers ...
>
> Ie.
>
> max_y = '8'
> y = 42
> if (y > max_y):
> etc.
OK, that has sorted it - I've forced my x and y to be int's. But that
still didn't explain the behaviour.
repr(x) revealed that x was a string while max_x was an int but the
program still managed to produce the right result. Whereas y was exactly
the same but didn't come up the same. This is what confused me initially!
Thanks,
Dan
--
"There must and shall be aspirin. If I do not have aspirin, I shall die."
More information about the Python-list
mailing list