I dont get this!

Emile van Sebille emile at fenx.com
Thu Aug 23 19:42:41 EDT 2001


Try testing the type of the functions return values:

>>> value = '103'
>>> low = '25'
>>> print value, low
103 25
>>> print value < low
1

HTH,

--

Emile van Sebille
emile at fenx.com

---------
"Peter Sundling" <peter.sundling at telia.com> wrote in message
news:3B85805D.BAC86944 at telia.com...
> Help! :)
> I have been programming in python for some time now, and today i
> found a strange bug in my code i cant get rid of...
>
> Here is a code snippet where something is wrong somewhere:
>
>
> def check_hilo(i):
> if value[i] < low[i]:
> return 1
>
> if value[i] > high[i]:
> return 2
>
> return 0
>
>
> ...Simple, huh? I have never had any trouble with something like this
> before.
> The thing is that this procedure always returns 1.
> I have tried to rewrite this little source code a couple of times,
> in many different ways, and it still returns 1!
>
> If i compare value to high before i compare it to low, it still returns
> 1.
>
> As an example: value[i] was 103, low[i] was 25 and high[i] was 35.
> As far as i know, 103 is greater than 25. But python seemes to disagree
> on that...
> ( if i start the python alone and writes
> print 103 < 25
> it responds 0, But what the hell is wrong now??)
>
>
> /Peter
> (The dumbest programmer on the face of the earth)




More information about the Python-list mailing list